home *** CD-ROM | disk | FTP | other *** search
MacBinary | 1993-03-25 | 29.9 KB | [TEXT/MPS ] |
open in:
MacOS 8.1
|
Win98
|
DOS
browse contents |
view JSON data
|
view as text
This file was processed as: MacBinary
(archive/macBinary).
Confidence | Program | Detection | Match Type | Support
|
---|
66%
| dexvert
| Compact Compressed (Unix) (archive/compact)
| ext
| Supported |
1%
| dexvert
| MacBinary (archive/macBinary)
| fallback
| Supported |
1%
| dexvert
| Text File (text/txt)
| fallback
| Supported |
100%
| file
| MacBinary II, inited, Thu Mar 25 13:00:31 1993, modified Thu Mar 25 13:00:31 1993, creator 'MPS ', type ASCII, 29904 bytes "Sample.c" , at 0x7550 470 bytes resource
| default (weak)
| |
99%
| file
| data
| default
| |
74%
| TrID
| Macintosh plain text (MacBinary)
| default
| |
25%
| TrID
| MacBinary 2
| default (weak)
| |
100%
| dearkID
| deark: macbinary
| default
| |
100%
| siegfried
| fmt/1762 MacBinary (II)
| default
| |
100%
| lsar
| MacBinary
| default
|
|
id metadata |
---|
key | value |
---|
macFileType | [TEXT] |
macFileCreator | [MPS ] |
hex view+--------+-------------------------+-------------------------+--------+--------+
|00000000| 00 08 53 61 6d 70 6c 65 | 2e 63 00 00 00 00 00 00 |..Sample|.c......|
|00000010| 00 00 00 00 00 00 00 00 | 00 00 00 00 00 00 00 00 |........|........|
|00000020| 00 00 00 00 00 00 00 00 | 00 00 00 00 00 00 00 00 |........|........|
|00000030| 00 00 00 00 00 00 00 00 | 00 00 00 00 00 00 00 00 |........|........|
|00000040| 00 54 45 58 54 4d 50 53 | 20 01 00 00 00 00 00 00 |.TEXTMPS| .......|
|00000050| 00 00 00 00 00 74 d0 00 | 00 01 d6 a7 d7 a3 bf a7 |.....t..|........|
|00000060| d7 a3 bf 00 00 00 00 00 | 00 00 00 00 00 00 00 00 |........|........|
|00000070| 00 00 00 00 00 00 00 00 | 00 00 81 81 f6 1c 00 00 |........|........|
|00000080| 2f 2a a5 a5 a5 a5 a5 a5 | a5 a5 a5 a5 a5 a5 a5 a5 |/*......|........|
|00000090| a5 a5 a5 a5 a5 a5 a5 a5 | a5 a5 a5 a5 a5 a5 a5 a5 |........|........|
|000000a0| a5 a5 a5 a5 a5 a5 a5 a5 | a5 a5 a5 a5 a5 a5 a5 a5 |........|........|
|000000b0| a5 a5 a5 a5 a5 a5 a5 a5 | a5 a5 a5 a5 a5 a5 a5 a5 |........|........|
|000000c0| a5 a5 a5 a5 a5 a5 a5 a5 | a5 a5 a5 a5 a5 a5 a5 a5 |........|........|
|000000d0| a5 a5 a5 a5 a5 a5 a5 a5 | a5 a5 a5 a5 a5 a5 a5 a5 |........|........|
|000000e0| a5 a5 a5 0d 2f 2a 20 53 | 61 6d 70 6c 65 2e 63 0d |..../* S|ample.c.|
|000000f0| 2f 2a 0d 2f 2a 20 4d 6f | 64 69 66 69 65 64 20 66 |/*./* Mo|dified f|
|00000100| 6f 72 20 56 69 72 74 75 | 61 6c 20 53 70 68 65 72 |or Virtu|al Spher|
|00000110| 65 20 53 61 6d 70 6c 65 | 20 43 6f 64 65 20 52 65 |e Sample| Code Re|
|00000120| 6c 65 61 73 65 20 76 31 | 2e 31 0d 2f 2a 0d 2f 2a |lease v1|.1./*./*|
|00000130| 20 41 75 74 68 6f 72 3a | 20 4d 69 63 68 61 65 6c | Author:| Michael|
|00000140| 20 43 68 65 6e 2c 20 48 | 75 6d 61 6e 20 49 6e 74 | Chen, H|uman Int|
|00000150| 65 72 66 61 63 65 20 47 | 72 6f 75 70 20 2f 20 41 |erface G|roup / A|
|00000160| 54 47 0d 2f 2a 20 43 6f | 70 79 72 69 67 68 74 20 |TG./* Co|pyright |
|00000170| a9 20 31 39 39 31 2d 31 | 39 39 33 20 41 70 70 6c |. 1991-1|993 Appl|
|00000180| 65 20 43 6f 6d 70 75 74 | 65 72 2c 20 49 6e 63 2e |e Comput|er, Inc.|
|00000190| 20 20 41 6c 6c 20 72 69 | 67 68 74 73 20 72 65 73 | All ri|ghts res|
|000001a0| 65 72 76 65 64 2e 0d 2f | 2a a5 a5 a5 a5 a5 a5 a5 |erved../|*.......|
|000001b0| a5 a5 a5 a5 a5 a5 a5 a5 | a5 a5 a5 a5 a5 a5 a5 a5 |........|........|
|000001c0| a5 a5 a5 a5 a5 a5 a5 a5 | a5 a5 a5 a5 a5 a5 a5 a5 |........|........|
|000001d0| a5 a5 a5 a5 a5 a5 a5 a5 | a5 a5 a5 a5 a5 a5 a5 a5 |........|........|
|000001e0| a5 a5 a5 a5 a5 a5 a5 a5 | a5 a5 a5 a5 a5 a5 a5 a5 |........|........|
|000001f0| a5 a5 a5 a5 a5 a5 a5 a5 | a5 a5 a5 a5 a5 a5 a5 a5 |........|........|
|00000200| a5 a5 a5 a5 a5 a5 a5 a5 | a5 a5 2a 2f 0d 2f 2a 2d |........|..*/./*-|
|00000210| 2d 2d 2d 2d 2d 2d 2d 2d | 2d 2d 2d 2d 2d 2d 2d 2d |--------|--------|
|00000220| 2d 2d 2d 2d 2d 2d 2d 2d | 2d 2d 2d 2d 2d 2d 2d 2d |--------|--------|
|00000230| 2d 2d 2d 2d 2d 2d 2d 2d | 2d 2d 2d 2d 2d 2d 2d 2d |--------|--------|
|00000240| 2d 2d 2d 2d 2d 2d 2d 2d | 2d 2d 2d 2d 2d 2d 2d 2d |--------|--------|
|00000250| 2d 2d 2d 2d 2d 2d 2d 2d | 2d 2d 2d 2d 2d 0d 23 0d |--------|-----.#.|
|00000260| 23 09 41 70 70 6c 65 20 | 4d 61 63 69 6e 74 6f 73 |#.Apple |Macintos|
|00000270| 68 20 44 65 76 65 6c 6f | 70 65 72 20 54 65 63 68 |h Develo|per Tech|
|00000280| 6e 69 63 61 6c 20 53 75 | 70 70 6f 72 74 0d 23 0d |nical Su|pport.#.|
|00000290| 23 09 4d 75 6c 74 69 46 | 69 6e 64 65 72 2d 41 77 |#.MultiF|inder-Aw|
|000002a0| 61 72 65 20 53 69 6d 70 | 6c 65 20 53 61 6d 70 6c |are Simp|le Sampl|
|000002b0| 65 20 41 70 70 6c 69 63 | 61 74 69 6f 6e 0d 23 0d |e Applic|ation.#.|
|000002c0| 23 09 53 61 6d 70 6c 65 | 0d 23 0d 23 09 53 61 6d |#.Sample|.#.#.Sam|
|000002d0| 70 6c 65 2e 63 09 2d 09 | 43 20 53 6f 75 72 63 65 |ple.c.-.|C Source|
|000002e0| 0d 23 0d 23 09 43 6f 70 | 79 72 69 67 68 74 20 a9 |.#.#.Cop|yright .|
|000002f0| 20 41 70 70 6c 65 20 43 | 6f 6d 70 75 74 65 72 2c | Apple C|omputer,|
|00000300| 20 49 6e 63 2e 20 31 39 | 38 39 2d 31 39 39 30 0d | Inc. 19|89-1990.|
|00000310| 23 09 41 6c 6c 20 72 69 | 67 68 74 73 20 72 65 73 |#.All ri|ghts res|
|00000320| 65 72 76 65 64 2e 0d 23 | 0d 23 09 56 65 72 73 69 |erved..#|.#.Versi|
|00000330| 6f 6e 73 3a 09 0d 23 09 | 09 09 09 31 2e 30 30 09 |ons:..#.|...1.00.|
|00000340| 09 09 09 30 38 2f 38 38 | 0d 23 09 09 09 09 31 2e |...08/88|.#....1.|
|00000350| 30 31 09 09 09 09 31 31 | 2f 38 38 0d 23 09 09 09 |01....11|/88.#...|
|00000360| 09 31 2e 30 32 09 09 09 | 09 30 34 2f 38 39 09 4d |.1.02...|.04/89.M|
|00000370| 50 57 20 33 2e 31 0d 23 | 09 09 09 09 31 2e 30 33 |PW 3.1.#|....1.03|
|00000380| 09 09 09 09 30 32 2f 39 | 30 09 4d 50 57 20 33 2e |....02/9|0.MPW 3.|
|00000390| 32 0d 23 0d 23 09 43 6f | 6d 70 6f 6e 65 6e 74 73 |2.#.#.Co|mponents|
|000003a0| 3a 0d 23 09 09 09 09 53 | 61 6d 70 6c 65 2e 63 09 |:.#....S|ample.c.|
|000003b0| 09 09 46 65 62 2e 20 20 | 31 2c 20 31 39 39 30 0d |..Feb. |1, 1990.|
|000003c0| 23 09 09 09 09 53 61 6d | 70 6c 65 2e 72 09 09 09 |#....Sam|ple.r...|
|000003d0| 46 65 62 2e 20 20 31 2c | 20 31 39 39 30 0d 23 09 |Feb. 1,| 1990.#.|
|000003e0| 09 09 09 53 61 6d 70 6c | 65 2e 68 09 09 09 46 65 |...Sampl|e.h...Fe|
|000003f0| 62 2e 20 20 31 2c 20 31 | 39 39 30 0d 23 09 09 09 |b. 1, 1|990.#...|
|00000400| 09 53 61 6d 70 6c 65 2e | 6d 61 6b 65 09 09 09 46 |.Sample.|make...F|
|00000410| 65 62 2e 20 20 31 2c 20 | 31 39 39 30 0d 23 0d 23 |eb. 1, |1990.#.#|
|00000420| 09 53 61 6d 70 6c 65 20 | 69 73 20 61 6e 20 65 78 |.Sample |is an ex|
|00000430| 61 6d 70 6c 65 20 61 70 | 70 6c 69 63 61 74 69 6f |ample ap|plicatio|
|00000440| 6e 20 74 68 61 74 20 64 | 65 6d 6f 6e 73 74 72 61 |n that d|emonstra|
|00000450| 74 65 73 20 68 6f 77 20 | 74 6f 0d 23 09 69 6e 69 |tes how |to.#.ini|
|00000460| 74 69 61 6c 69 7a 65 20 | 74 68 65 20 63 6f 6d 6d |tialize |the comm|
|00000470| 6f 6e 6c 79 20 75 73 65 | 64 20 74 6f 6f 6c 62 6f |only use|d toolbo|
|00000480| 78 20 6d 61 6e 61 67 65 | 72 73 2c 20 6f 70 65 72 |x manage|rs, oper|
|00000490| 61 74 65 20 0d 23 09 73 | 75 63 63 65 73 73 66 75 |ate .#.s|uccessfu|
|000004a0| 6c 6c 79 20 75 6e 64 65 | 72 20 4d 75 6c 74 69 46 |lly unde|r MultiF|
|000004b0| 69 6e 64 65 72 2c 20 68 | 61 6e 64 6c 65 20 64 65 |inder, h|andle de|
|000004c0| 73 6b 20 61 63 63 65 73 | 73 6f 72 69 65 73 2c 20 |sk acces|sories, |
|000004d0| 0d 23 09 61 6e 64 20 63 | 72 65 61 74 65 2c 20 67 |.#.and c|reate, g|
|000004e0| 72 6f 77 2c 20 61 6e 64 | 20 7a 6f 6f 6d 20 77 69 |row, and| zoom wi|
|000004f0| 6e 64 6f 77 73 2e 0d 23 | 0d 23 09 49 74 20 64 6f |ndows..#|.#.It do|
|00000500| 65 73 20 6e 6f 74 20 62 | 79 20 61 6e 79 20 6d 65 |es not b|y any me|
|00000510| 61 6e 73 20 64 65 6d 6f | 6e 73 74 72 61 74 65 20 |ans demo|nstrate |
|00000520| 61 6c 6c 20 74 68 65 20 | 74 65 63 68 6e 69 71 75 |all the |techniqu|
|00000530| 65 73 20 0d 23 09 79 6f | 75 20 6e 65 65 64 20 66 |es .#.yo|u need f|
|00000540| 6f 72 20 61 20 6c 61 72 | 67 65 20 61 70 70 6c 69 |or a lar|ge appli|
|00000550| 63 61 74 69 6f 6e 2e 20 | 49 6e 20 70 61 72 74 69 |cation. |In parti|
|00000560| 63 75 6c 61 72 2c 20 53 | 61 6d 70 6c 65 20 0d 23 |cular, S|ample .#|
|00000570| 09 64 6f 65 73 20 6e 6f | 74 20 63 6f 76 65 72 20 |.does no|t cover |
|00000580| 65 78 63 65 70 74 69 6f | 6e 20 68 61 6e 64 6c 69 |exceptio|n handli|
|00000590| 6e 67 2c 20 6d 75 6c 74 | 69 70 6c 65 20 77 69 6e |ng, mult|iple win|
|000005a0| 64 6f 77 73 2f 64 6f 63 | 75 6d 65 6e 74 73 2c 20 |dows/doc|uments, |
|000005b0| 0d 23 09 73 6f 70 68 69 | 73 74 69 63 61 74 65 64 |.#.sophi|sticated|
|000005c0| 20 6d 65 6d 6f 72 79 20 | 6d 61 6e 61 67 65 6d 65 | memory |manageme|
|000005d0| 6e 74 2c 20 70 72 69 6e | 74 69 6e 67 2c 20 6f 72 |nt, prin|ting, or|
|000005e0| 20 75 6e 64 6f 2e 20 41 | 6c 6c 20 6f 66 20 0d 23 | undo. A|ll of .#|
|000005f0| 09 74 68 65 73 65 20 61 | 72 65 20 76 69 74 61 6c |.these a|re vital|
|00000600| 20 70 61 72 74 73 20 6f | 66 20 61 20 6e 6f 72 6d | parts o|f a norm|
|00000610| 61 6c 20 66 75 6c 6c 2d | 73 69 7a 65 64 20 61 70 |al full-|sized ap|
|00000620| 70 6c 69 63 61 74 69 6f | 6e 2e 0d 23 0d 23 09 54 |plicatio|n..#.#.T|
|00000630| 68 69 73 20 61 70 70 6c | 69 63 61 74 69 6f 6e 20 |his appl|ication |
|00000640| 69 73 20 61 6e 20 65 78 | 61 6d 70 6c 65 20 6f 66 |is an ex|ample of|
|00000650| 20 74 68 65 20 66 6f 72 | 6d 20 6f 66 20 61 20 4d | the for|m of a M|
|00000660| 61 63 69 6e 74 6f 73 68 | 20 0d 23 09 61 70 70 6c |acintosh| .#.appl|
|00000670| 69 63 61 74 69 6f 6e 3b | 20 69 74 20 69 73 20 4e |ication;| it is N|
|00000680| 4f 54 20 61 20 74 65 6d | 70 6c 61 74 65 2e 20 49 |OT a tem|plate. I|
|00000690| 74 20 69 73 20 4e 4f 54 | 20 69 6e 74 65 6e 64 65 |t is NOT| intende|
|000006a0| 64 20 74 6f 20 62 65 20 | 0d 23 09 75 73 65 64 20 |d to be |.#.used |
|000006b0| 61 73 20 61 20 66 6f 75 | 6e 64 61 74 69 6f 6e 20 |as a fou|ndation |
|000006c0| 66 6f 72 20 74 68 65 20 | 6e 65 78 74 20 77 6f 72 |for the |next wor|
|000006d0| 6c 64 2d 63 6c 61 73 73 | 2c 20 62 65 73 74 2d 73 |ld-class|, best-s|
|000006e0| 65 6c 6c 69 6e 67 2c 20 | 0d 23 09 36 30 30 4b 20 |elling, |.#.600K |
|000006f0| 61 70 70 6c 69 63 61 74 | 69 6f 6e 2e 20 41 20 73 |applicat|ion. A s|
|00000700| 74 69 63 6b 20 66 69 67 | 75 72 65 20 64 72 61 77 |tick fig|ure draw|
|00000710| 69 6e 67 20 6f 66 20 74 | 68 65 20 68 75 6d 61 6e |ing of t|he human|
|00000720| 20 62 6f 64 79 20 6d 61 | 79 20 0d 23 09 62 65 20 | body ma|y .#.be |
|00000730| 61 20 67 6f 6f 64 20 65 | 78 61 6d 70 6c 65 20 6f |a good e|xample o|
|00000740| 66 20 74 68 65 20 66 6f | 72 6d 20 66 6f 72 20 61 |f the fo|rm for a|
|00000750| 20 70 61 69 6e 74 69 6e | 67 2c 20 62 75 74 20 74 | paintin|g, but t|
|00000760| 68 61 74 20 64 6f 65 73 | 20 6e 6f 74 20 0d 23 09 |hat does| not .#.|
|00000770| 6d 65 61 6e 20 69 74 20 | 73 68 6f 75 6c 64 20 62 |mean it |should b|
|00000780| 65 20 75 73 65 64 20 61 | 73 20 74 68 65 20 62 61 |e used a|s the ba|
|00000790| 73 69 73 20 66 6f 72 20 | 74 68 65 20 6e 65 78 74 |sis for |the next|
|000007a0| 20 4d 6f 6e 61 20 4c 69 | 73 61 2e 0d 23 0d 23 09 | Mona Li|sa..#.#.|
|000007b0| 57 65 20 72 65 63 6f 6d | 6d 65 6e 64 20 74 68 61 |We recom|mend tha|
|000007c0| 74 20 79 6f 75 20 72 65 | 76 69 65 77 20 74 68 69 |t you re|view thi|
|000007d0| 73 20 70 72 6f 67 72 61 | 6d 20 6f 72 20 54 45 53 |s progra|m or TES|
|000007e0| 61 6d 70 6c 65 20 62 65 | 66 6f 72 65 20 0d 23 09 |ample be|fore .#.|
|000007f0| 62 65 67 69 6e 6e 69 6e | 67 20 61 20 6e 65 77 20 |beginnin|g a new |
|00000800| 61 70 70 6c 69 63 61 74 | 69 6f 6e 2e 0d 23 0d 2d |applicat|ion..#.-|
|00000810| 2d 2d 2d 2d 2d 2d 2d 2d | 2d 2d 2d 2d 2d 2d 2d 2d |--------|--------|
|00000820| 2d 2d 2d 2d 2d 2d 2d 2d | 2d 2d 2d 2d 2d 2d 2d 2d |--------|--------|
|00000830| 2d 2d 2d 2d 2d 2d 2d 2d | 2d 2d 2d 2d 2d 2d 2d 2d |--------|--------|
|00000840| 2d 2d 2d 2d 2d 2d 2d 2d | 2d 2d 2d 2d 2d 2d 2d 2d |--------|--------|
|00000850| 2d 2d 2d 2d 2d 2d 2d 2d | 2d 2d 2d 2d 2d 2a 2f 0d |--------|-----*/.|
|00000860| 0d 0d 2f 2a 20 53 65 67 | 6d 65 6e 74 61 74 69 6f |../* Seg|mentatio|
|00000870| 6e 20 73 74 72 61 74 65 | 67 79 3a 0d 0d 20 20 20 |n strate|gy:.. |
|00000880| 54 68 69 73 20 70 72 6f | 67 72 61 6d 20 63 6f 6e |This pro|gram con|
|00000890| 73 69 73 74 73 20 6f 66 | 20 74 68 72 65 65 20 73 |sists of| three s|
|000008a0| 65 67 6d 65 6e 74 73 2e | 20 4d 61 69 6e 20 63 6f |egments.| Main co|
|000008b0| 6e 74 61 69 6e 73 20 6d | 6f 73 74 20 6f 66 20 74 |ntains m|ost of t|
|000008c0| 68 65 20 63 6f 64 65 2c | 0d 20 20 20 69 6e 63 6c |he code,|. incl|
|000008d0| 75 64 69 6e 67 20 74 68 | 65 20 4d 50 57 20 6c 69 |uding th|e MPW li|
|000008e0| 62 72 61 72 69 65 73 2c | 20 61 6e 64 20 74 68 65 |braries,| and the|
|000008f0| 20 6d 61 69 6e 20 70 72 | 6f 67 72 61 6d 2e 20 49 | main pr|ogram. I|
|00000900| 6e 69 74 69 61 6c 69 7a | 65 20 63 6f 6e 74 61 69 |nitializ|e contai|
|00000910| 6e 73 0d 20 20 20 63 6f | 64 65 20 74 68 61 74 20 |ns. co|de that |
|00000920| 69 73 20 6f 6e 6c 79 20 | 75 73 65 64 20 6f 6e 63 |is only |used onc|
|00000930| 65 2c 20 64 75 72 69 6e | 67 20 73 74 61 72 74 75 |e, durin|g startu|
|00000940| 70 2c 20 61 6e 64 20 63 | 61 6e 20 62 65 20 75 6e |p, and c|an be un|
|00000950| 6c 6f 61 64 65 64 20 61 | 66 74 65 72 20 74 68 65 |loaded a|fter the|
|00000960| 0d 20 20 20 70 72 6f 67 | 72 61 6d 20 73 74 61 72 |. prog|ram star|
|00000970| 74 73 2e 20 25 41 35 49 | 6e 69 74 20 69 73 20 61 |ts. %A5I|nit is a|
|00000980| 75 74 6f 6d 61 74 69 63 | 61 6c 6c 79 20 63 72 65 |utomatic|ally cre|
|00000990| 61 74 65 64 20 62 79 20 | 74 68 65 20 4c 69 6e 6b |ated by |the Link|
|000009a0| 65 72 20 74 6f 20 69 6e | 69 74 69 61 6c 69 7a 65 |er to in|itialize|
|000009b0| 0d 20 20 20 67 6c 6f 62 | 61 6c 73 20 66 6f 72 20 |. glob|als for |
|000009c0| 74 68 65 20 4d 50 57 20 | 6c 69 62 72 61 72 69 65 |the MPW |librarie|
|000009d0| 73 20 61 6e 64 20 69 73 | 20 75 6e 6c 6f 61 64 65 |s and is| unloade|
|000009e0| 64 20 72 69 67 68 74 20 | 61 77 61 79 2e 20 2a 2f |d right |away. */|
|000009f0| 0d 0d 0d 2f 2a 20 53 65 | 74 50 6f 72 74 20 73 74 |.../* Se|tPort st|
|00000a00| 72 61 74 65 67 79 3a 0d | 0d 20 20 20 54 6f 6f 6c |rategy:.|. Tool|
|00000a10| 62 6f 78 20 72 6f 75 74 | 69 6e 65 73 20 64 6f 20 |box rout|ines do |
|00000a20| 6e 6f 74 20 63 68 61 6e | 67 65 20 74 68 65 20 63 |not chan|ge the c|
|00000a30| 75 72 72 65 6e 74 20 70 | 6f 72 74 2e 20 49 6e 20 |urrent p|ort. In |
|00000a40| 73 70 69 74 65 20 6f 66 | 20 74 68 69 73 2c 20 69 |spite of| this, i|
|00000a50| 6e 20 74 68 69 73 0d 20 | 20 20 70 72 6f 67 72 61 |n this. | progra|
|00000a60| 6d 20 77 65 20 75 73 65 | 20 61 20 73 74 72 61 74 |m we use| a strat|
|00000a70| 65 67 79 20 6f 66 20 63 | 61 6c 6c 69 6e 67 20 53 |egy of c|alling S|
|00000a80| 65 74 50 6f 72 74 20 77 | 68 65 6e 65 76 65 72 20 |etPort w|henever |
|00000a90| 77 65 20 77 61 6e 74 20 | 74 6f 20 64 72 61 77 20 |we want |to draw |
|00000aa0| 6f 72 0d 20 20 20 6d 61 | 6b 65 20 63 61 6c 6c 73 |or. ma|ke calls|
|00000ab0| 20 77 68 69 63 68 20 64 | 65 70 65 6e 64 20 6f 6e | which d|epend on|
|00000ac0| 20 74 68 65 20 63 75 72 | 72 65 6e 74 20 70 6f 72 | the cur|rent por|
|00000ad0| 74 2e 20 54 68 69 73 20 | 6d 61 6b 65 73 20 75 73 |t. This |makes us|
|00000ae0| 20 6c 65 73 73 20 76 75 | 6c 6e 65 72 61 62 6c 65 | less vu|lnerable|
|00000af0| 0d 20 20 20 74 6f 20 62 | 75 67 73 20 69 6e 20 6f |. to b|ugs in o|
|00000b00| 74 68 65 72 20 73 6f 66 | 74 77 61 72 65 20 77 68 |ther sof|tware wh|
|00000b10| 69 63 68 20 6d 69 67 68 | 74 20 61 6c 74 65 72 20 |ich migh|t alter |
|00000b20| 74 68 65 20 63 75 72 72 | 65 6e 74 20 70 6f 72 74 |the curr|ent port|
|00000b30| 20 28 73 75 63 68 20 61 | 73 20 74 68 65 0d 20 20 | (such a|s the. |
|00000b40| 20 62 75 67 20 28 66 65 | 61 74 75 72 65 3f 29 20 | bug (fe|ature?) |
|00000b50| 69 6e 20 6d 61 6e 79 20 | 64 65 73 6b 20 61 63 63 |in many |desk acc|
|00000b60| 65 73 73 6f 72 69 65 73 | 20 77 68 69 63 68 20 63 |essories| which c|
|00000b70| 68 61 6e 67 65 20 74 68 | 65 20 70 6f 72 74 20 6f |hange th|e port o|
|00000b80| 6e 20 4f 70 65 6e 44 65 | 73 6b 41 63 63 29 2e 0d |n OpenDe|skAcc)..|
|00000b90| 20 20 20 48 6f 70 65 66 | 75 6c 6c 79 2c 20 74 68 | Hopef|ully, th|
|00000ba0| 69 73 20 61 6c 73 6f 20 | 6d 61 6b 65 73 20 74 68 |is also |makes th|
|00000bb0| 65 20 72 6f 75 74 69 6e | 65 73 20 66 72 6f 6d 20 |e routin|es from |
|00000bc0| 74 68 69 73 20 70 72 6f | 67 72 61 6d 20 6d 6f 72 |this pro|gram mor|
|00000bd0| 65 20 73 65 6c 66 2d 63 | 6f 6e 74 61 69 6e 65 64 |e self-c|ontained|
|00000be0| 2c 0d 20 20 20 73 69 6e | 63 65 20 74 68 65 79 20 |,. sin|ce they |
|00000bf0| 64 6f 6e 27 74 20 64 65 | 70 65 6e 64 20 6f 6e 20 |don't de|pend on |
|00000c00| 74 68 65 20 63 75 72 72 | 65 6e 74 20 70 6f 72 74 |the curr|ent port|
|00000c10| 20 73 65 74 74 69 6e 67 | 2e 20 2a 2f 0d 0d 23 69 | setting|. */..#i|
|00000c20| 66 6e 64 65 66 20 5f 5f | 47 4c 4f 42 41 4c 53 5f |fndef __|GLOBALS_|
|00000c30| 5f 0d 23 69 6e 63 6c 75 | 64 65 20 22 47 6c 6f 62 |_.#inclu|de "Glob|
|00000c40| 61 6c 73 2e 68 22 0d 23 | 65 6e 64 69 66 0d 0d 2f |als.h".#|endif../|
|00000c50| 2a 2d 2d 2d 2d 2d 2d 2d | 2d 2d 2d 2d 2d 2d 2d 2d |*-------|--------|
|00000c60| 2d 2d 2d 2d 2d 2d 2d 2d | 2d 2d 2d 2d 2d 2d 2d 2d |--------|--------|
|00000c70| 2d 2d 2d 2d 2d 2d 2d 2d | 2d 2d 2d 2d 2d 2d 2d 2d |--------|--------|
|00000c80| 2d 2d 2d 2d 2d 2d 2d 2d | 2d 2d 2d 2d 2d 2d 2d 2d |--------|--------|
|00000c90| 2d 2d 2d 2d 2d 2d 2d 2d | 2d 2d 2d 2d 2d 2d 2d 2a |--------|-------*|
|00000ca0| 2f 0d 23 69 66 64 65 66 | 20 54 48 49 4e 4b 5f 43 |/.#ifdef| THINK_C|
|00000cb0| 0d 0d 23 69 66 6e 64 65 | 66 20 5f 5f 54 52 41 50 |..#ifnde|f __TRAP|
|00000cc0| 53 5f 5f 0d 23 69 6e 63 | 6c 75 64 65 20 3c 54 72 |S__.#inc|lude <Tr|
|00000cd0| 61 70 73 2e 68 3e 0d 23 | 65 6e 64 69 66 0d 0d 23 |aps.h>.#|endif..#|
|00000ce0| 69 66 6e 64 65 66 20 5f | 5f 56 41 4c 55 45 53 5f |ifndef _|_VALUES_|
|00000cf0| 5f 0d 23 69 6e 63 6c 75 | 64 65 20 3c 56 61 6c 75 |_.#inclu|de <Valu|
|00000d00| 65 73 2e 68 3e 0d 23 65 | 6e 64 69 66 0d 0d 0d 23 |es.h>.#e|ndif...#|
|00000d10| 65 6e 64 69 66 20 54 48 | 49 4e 4b 5f 43 0d 2f 2a |endif TH|INK_C./*|
|00000d20| 2d 2d 2d 2d 2d 2d 2d 2d | 2d 2d 2d 2d 2d 2d 2d 2d |--------|--------|
|00000d30| 2d 2d 2d 2d 2d 2d 2d 2d | 2d 2d 2d 2d 2d 2d 2d 2d |--------|--------|
|00000d40| 2d 2d 2d 2d 2d 2d 2d 2d | 2d 2d 2d 2d 2d 2d 2d 2d |--------|--------|
|00000d50| 2d 2d 2d 2d 2d 2d 2d 2d | 2d 2d 2d 2d 2d 2d 2d 2d |--------|--------|
|00000d60| 2d 2d 2d 2d 2d 2d 2d 2d | 2d 2d 2d 2d 2d 2d 2a 2f |--------|------*/|
|00000d70| 0d 23 69 66 64 65 66 20 | 61 70 70 6c 65 63 0d 23 |.#ifdef |applec.#|
|00000d80| 69 6e 63 6c 75 64 65 20 | 3c 56 61 6c 75 65 73 2e |include |<Values.|
|00000d90| 68 3e 0d 23 69 6e 63 6c | 75 64 65 20 3c 54 79 70 |h>.#incl|ude <Typ|
|00000da0| 65 73 2e 68 3e 0d 23 69 | 6e 63 6c 75 64 65 20 3c |es.h>.#i|nclude <|
|00000db0| 52 65 73 6f 75 72 63 65 | 73 2e 68 3e 0d 23 69 6e |Resource|s.h>.#in|
|00000dc0| 63 6c 75 64 65 20 3c 51 | 75 69 63 6b 44 72 61 77 |clude <Q|uickDraw|
|00000dd0| 2e 68 3e 0d 23 69 6e 63 | 6c 75 64 65 20 3c 46 6f |.h>.#inc|lude <Fo|
|00000de0| 6e 74 73 2e 68 3e 0d 23 | 69 6e 63 6c 75 64 65 20 |nts.h>.#|include |
|00000df0| 3c 45 76 65 6e 74 73 2e | 68 3e 0d 23 69 6e 63 6c |<Events.|h>.#incl|
|00000e00| 75 64 65 20 3c 57 69 6e | 64 6f 77 73 2e 68 3e 0d |ude <Win|dows.h>.|
|00000e10| 23 69 6e 63 6c 75 64 65 | 20 3c 4d 65 6e 75 73 2e |#include| <Menus.|
|00000e20| 68 3e 0d 23 69 6e 63 6c | 75 64 65 20 3c 54 65 78 |h>.#incl|ude <Tex|
|00000e30| 74 45 64 69 74 2e 68 3e | 0d 23 69 6e 63 6c 75 64 |tEdit.h>|.#includ|
|00000e40| 65 20 3c 44 69 61 6c 6f | 67 73 2e 68 3e 0d 23 69 |e <Dialo|gs.h>.#i|
|00000e50| 6e 63 6c 75 64 65 20 3c | 44 65 73 6b 2e 68 3e 0d |nclude <|Desk.h>.|
|00000e60| 23 69 6e 63 6c 75 64 65 | 20 3c 54 6f 6f 6c 55 74 |#include| <ToolUt|
|00000e70| 69 6c 73 2e 68 3e 0d 23 | 69 6e 63 6c 75 64 65 20 |ils.h>.#|include |
|00000e80| 3c 4d 65 6d 6f 72 79 2e | 68 3e 0d 23 69 6e 63 6c |<Memory.|h>.#incl|
|00000e90| 75 64 65 20 3c 53 65 67 | 4c 6f 61 64 2e 68 3e 0d |ude <Seg|Load.h>.|
|00000ea0| 23 69 6e 63 6c 75 64 65 | 20 3c 46 69 6c 65 73 2e |#include| <Files.|
|00000eb0| 68 3e 0d 23 69 6e 63 6c | 75 64 65 20 3c 4f 53 55 |h>.#incl|ude <OSU|
|00000ec0| 74 69 6c 73 2e 68 3e 0d | 23 69 6e 63 6c 75 64 65 |tils.h>.|#include|
|00000ed0| 20 3c 4f 53 45 76 65 6e | 74 73 2e 68 3e 0d 23 69 | <OSEven|ts.h>.#i|
|00000ee0| 6e 63 6c 75 64 65 20 3c | 44 69 73 6b 49 6e 69 74 |nclude <|DiskInit|
|00000ef0| 2e 68 3e 0d 23 69 6e 63 | 6c 75 64 65 20 3c 50 61 |.h>.#inc|lude <Pa|
|00000f00| 63 6b 61 67 65 73 2e 68 | 3e 0d 23 69 6e 63 6c 75 |ckages.h|>.#inclu|
|00000f10| 64 65 20 3c 54 72 61 70 | 73 2e 68 3e 0d 23 65 6e |de <Trap|s.h>.#en|
|00000f20| 64 69 66 20 61 70 70 6c | 65 63 0d 2f 2a 2d 2d 2d |dif appl|ec./*---|
|00000f30| 2d 2d 2d 2d 2d 2d 2d 2d | 2d 2d 2d 2d 2d 2d 2d 2d |--------|--------|
|00000f40| 2d 2d 2d 2d 2d 2d 2d 2d | 2d 2d 2d 2d 2d 2d 2d 2d |--------|--------|
|00000f50| 2d 2d 2d 2d 2d 2d 2d 2d | 2d 2d 2d 2d 2d 2d 2d 2d |--------|--------|
|00000f60| 2d 2d 2d 2d 2d 2d 2d 2d | 2d 2d 2d 2d 2d 2d 2d 2d |--------|--------|
|00000f70| 2d 2d 2d 2d 2d 2d 2d 2d | 2d 2d 2d 2a 2f 0d 0d 23 |--------|---*/..#|
|00000f80| 69 6e 63 6c 75 64 65 20 | 22 53 61 6d 70 6c 65 2e |include |"Sample.|
|00000f90| 68 22 09 09 09 09 2f 2a | 20 62 72 69 6e 67 20 69 |h"..../*| bring i|
|00000fa0| 6e 20 61 6c 6c 20 74 68 | 65 20 23 64 65 66 69 6e |n all th|e #defin|
|00000fb0| 65 73 20 66 6f 72 20 53 | 61 6d 70 6c 65 20 2a 2f |es for S|ample */|
|00000fc0| 0d 0d 23 69 66 6e 64 65 | 66 09 5f 5f 53 41 4d 50 |..#ifnde|f.__SAMP|
|00000fd0| 4c 45 41 44 44 49 54 49 | 4f 4e 41 4c 5f 5f 0d 23 |LEADDITI|ONAL__.#|
|00000fe0| 69 6e 63 6c 75 64 65 20 | 22 53 61 6d 70 6c 65 41 |include |"SampleA|
|00000ff0| 64 64 69 74 69 6f 6e 61 | 6c 2e 68 22 0d 23 65 6e |dditiona|l.h".#en|
|00001000| 64 69 66 0d 0d 2f 2a 20 | 54 68 65 20 22 67 22 20 |dif../* |The "g" |
|00001010| 70 72 65 66 69 78 20 69 | 73 20 75 73 65 64 20 74 |prefix i|s used t|
|00001020| 6f 20 65 6d 70 68 61 73 | 69 7a 65 20 74 68 61 74 |o emphas|ize that|
|00001030| 20 61 20 76 61 72 69 61 | 62 6c 65 20 69 73 20 67 | a varia|ble is g|
|00001040| 6c 6f 62 61 6c 2e 20 2a | 2f 0d 0d 2f 2a 20 47 4d |lobal. *|/../* GM|
|00001050| 61 63 20 69 73 20 75 73 | 65 64 20 74 6f 20 68 6f |ac is us|ed to ho|
|00001060| 6c 64 20 74 68 65 20 72 | 65 73 75 6c 74 20 6f 66 |ld the r|esult of|
|00001070| 20 61 20 53 79 73 45 6e | 76 69 72 6f 6e 73 20 63 | a SysEn|virons c|
|00001080| 61 6c 6c 2e 20 54 68 69 | 73 20 6d 61 6b 65 73 0d |all. Thi|s makes.|
|00001090| 20 20 20 69 74 20 63 6f | 6e 76 65 6e 69 65 6e 74 | it co|nvenient|
|000010a0| 20 66 6f 72 20 61 6e 79 | 20 72 6f 75 74 69 6e 65 | for any| routine|
|000010b0| 20 74 6f 20 63 68 65 63 | 6b 20 74 68 65 20 65 6e | to chec|k the en|
|000010c0| 76 69 72 6f 6e 6d 65 6e | 74 2e 20 2a 2f 0d 53 79 |vironmen|t. */.Sy|
|000010d0| 73 45 6e 76 52 65 63 09 | 67 4d 61 63 3b 09 09 09 |sEnvRec.|gMac;...|
|000010e0| 09 2f 2a 20 73 65 74 20 | 75 70 20 62 79 20 49 6e |./* set |up by In|
|000010f0| 69 74 69 61 6c 69 7a 65 | 20 2a 2f 0d 0d 2f 2a 20 |itialize| */../* |
|00001100| 47 48 61 73 57 61 69 74 | 4e 65 78 74 45 76 65 6e |GHasWait|NextEven|
|00001110| 74 20 69 73 20 73 65 74 | 20 61 74 20 73 74 61 72 |t is set| at star|
|00001120| 74 75 70 2c 20 61 6e 64 | 20 74 65 6c 6c 73 20 77 |tup, and| tells w|
|00001130| 68 65 74 68 65 72 20 74 | 68 65 20 57 61 69 74 4e |hether t|he WaitN|
|00001140| 65 78 74 45 76 65 6e 74 | 0d 20 20 20 74 72 61 70 |extEvent|. trap|
|00001150| 20 69 73 20 61 76 61 69 | 6c 61 62 6c 65 2e 20 49 | is avai|lable. I|
|00001160| 66 20 69 74 20 69 73 20 | 66 61 6c 73 65 2c 20 77 |f it is |false, w|
|00001170| 65 20 6b 6e 6f 77 20 74 | 68 61 74 20 77 65 20 6d |e know t|hat we m|
|00001180| 75 73 74 20 63 61 6c 6c | 20 47 65 74 4e 65 78 74 |ust call| GetNext|
|00001190| 45 76 65 6e 74 2e 20 2a | 2f 0d 42 6f 6f 6c 65 61 |Event. *|/.Boolea|
|000011a0| 6e 09 09 67 48 61 73 57 | 61 69 74 4e 65 78 74 45 |n..gHasW|aitNextE|
|000011b0| 76 65 6e 74 3b 09 2f 2a | 20 73 65 74 20 75 70 20 |vent;./*| set up |
|000011c0| 62 79 20 49 6e 69 74 69 | 61 6c 69 7a 65 20 2a 2f |by Initi|alize */|
|000011d0| 0d 0d 2f 2a 20 47 49 6e | 42 61 63 6b 67 72 6f 75 |../* GIn|Backgrou|
|000011e0| 6e 64 20 69 73 20 6d 61 | 69 6e 74 61 69 6e 65 64 |nd is ma|intained|
|000011f0| 20 62 79 20 6f 75 72 20 | 6f 73 45 76 65 6e 74 20 | by our |osEvent |
|00001200| 68 61 6e 64 6c 69 6e 67 | 20 72 6f 75 74 69 6e 65 |handling| routine|
|00001210| 73 2e 20 41 6e 79 20 70 | 61 72 74 20 6f 66 0d 20 |s. Any p|art of. |
|00001220| 20 20 74 68 65 20 70 72 | 6f 67 72 61 6d 20 63 61 | the pr|ogram ca|
|00001230| 6e 20 63 68 65 63 6b 20 | 69 74 20 74 6f 20 66 69 |n check |it to fi|
|00001240| 6e 64 20 6f 75 74 20 69 | 66 20 69 74 20 69 73 20 |nd out i|f it is |
|00001250| 63 75 72 72 65 6e 74 6c | 79 20 69 6e 20 74 68 65 |currentl|y in the|
|00001260| 20 62 61 63 6b 67 72 6f | 75 6e 64 2e 20 2a 2f 0d | backgro|und. */.|
|00001270| 42 6f 6f 6c 65 61 6e 09 | 09 67 49 6e 42 61 63 6b |Boolean.|.gInBack|
|00001280| 67 72 6f 75 6e 64 3b 09 | 09 2f 2a 20 6d 61 69 6e |ground;.|./* main|
|00001290| 74 61 69 6e 65 64 20 62 | 79 20 49 6e 69 74 69 61 |tained b|y Initia|
|000012a0| 6c 69 7a 65 20 61 6e 64 | 20 44 6f 45 76 65 6e 74 |lize and| DoEvent|
|000012b0| 20 2a 2f 0d 0d 0d 2f 2a | 20 54 68 65 20 66 6f 6c | */.../*| The fol|
|000012c0| 6c 6f 77 69 6e 67 20 67 | 6c 6f 62 61 6c 73 20 61 |lowing g|lobals a|
|000012d0| 72 65 20 74 68 65 20 73 | 74 61 74 65 20 6f 66 20 |re the s|tate of |
|000012e0| 74 68 65 20 77 69 6e 64 | 6f 77 2e 20 49 66 20 77 |the wind|ow. If w|
|000012f0| 65 20 73 75 70 70 6f 72 | 74 65 64 20 6d 6f 72 65 |e suppor|ted more|
|00001300| 20 74 68 61 6e 0d 20 20 | 20 6f 6e 65 20 77 69 6e | than. | one win|
|00001310| 64 6f 77 2c 20 74 68 65 | 79 20 77 6f 75 6c 64 20 |dow, the|y would |
|00001320| 62 65 20 61 74 74 61 74 | 63 68 65 64 20 74 6f 20 |be attat|ched to |
|00001330| 65 61 63 68 20 64 6f 63 | 75 6d 65 6e 74 2c 20 72 |each doc|ument, r|
|00001340| 61 74 68 65 72 20 74 68 | 61 6e 20 67 6c 6f 62 61 |ather th|an globa|
|00001350| 6c 73 2e 20 2a 2f 0d 0d | 0d 0d 0d 2f 2a 20 48 65 |ls. */..|.../* He|
|00001360| 72 65 20 61 72 65 20 64 | 65 63 6c 61 72 61 74 69 |re are d|eclarati|
|00001370| 6f 6e 73 20 66 6f 72 20 | 61 6c 6c 20 6f 66 20 74 |ons for |all of t|
|00001380| 68 65 20 43 20 72 6f 75 | 74 69 6e 65 73 2e 20 49 |he C rou|tines. I|
|00001390| 6e 20 4d 50 57 20 33 2e | 30 20 77 65 20 63 61 6e |n MPW 3.|0 we can|
|000013a0| 20 75 73 65 0d 20 20 20 | 61 63 74 75 61 6c 20 70 | use. |actual p|
|000013b0| 72 6f 74 6f 74 79 70 65 | 73 20 66 6f 72 20 70 61 |rototype|s for pa|
|000013c0| 72 61 6d 65 74 65 72 20 | 74 79 70 65 20 63 68 65 |rameter |type che|
|000013d0| 63 6b 69 6e 67 2e 20 2a | 2f 0d 76 6f 69 64 20 45 |cking. *|/.void E|
|000013e0| 76 65 6e 74 4c 6f 6f 70 | 28 20 76 6f 69 64 20 29 |ventLoop|( void )|
|000013f0| 3b 0d 76 6f 69 64 20 44 | 6f 45 76 65 6e 74 28 20 |;.void D|oEvent( |
|00001400| 45 76 65 6e 74 52 65 63 | 6f 72 64 20 2a 65 76 65 |EventRec|ord *eve|
|00001410| 6e 74 20 29 3b 0d 76 6f | 69 64 20 41 64 6a 75 73 |nt );.vo|id Adjus|
|00001420| 74 43 75 72 73 6f 72 28 | 20 50 6f 69 6e 74 20 6d |tCursor(| Point m|
|00001430| 6f 75 73 65 2c 20 52 67 | 6e 48 61 6e 64 6c 65 20 |ouse, Rg|nHandle |
|00001440| 72 65 67 69 6f 6e 20 29 | 3b 0d 76 6f 69 64 20 47 |region )|;.void G|
|00001450| 65 74 47 6c 6f 62 61 6c | 4d 6f 75 73 65 28 20 50 |etGlobal|Mouse( P|
|00001460| 6f 69 6e 74 20 2a 6d 6f | 75 73 65 20 29 3b 0d 76 |oint *mo|use );.v|
|00001470| 6f 69 64 20 44 6f 55 70 | 64 61 74 65 28 20 57 69 |oid DoUp|date( Wi|
|00001480| 6e 64 6f 77 50 74 72 20 | 77 69 6e 64 6f 77 20 29 |ndowPtr |window )|
|00001490| 3b 0d 76 6f 69 64 20 44 | 6f 41 63 74 69 76 61 74 |;.void D|oActivat|
|000014a0| 65 28 20 57 69 6e 64 6f | 77 50 74 72 20 77 69 6e |e( Windo|wPtr win|
|000014b0| 64 6f 77 2c 20 42 6f 6f | 6c 65 61 6e 20 62 65 63 |dow, Boo|lean bec|
|000014c0| 6f 6d 69 6e 67 41 63 74 | 69 76 65 20 29 3b 0d 0d |omingAct|ive );..|
|000014d0| 2f 2a 76 6f 69 64 20 44 | 6f 43 6f 6e 74 65 6e 74 |/*void D|oContent|
|000014e0| 43 6c 69 63 6b 28 20 57 | 69 6e 64 6f 77 50 74 72 |Click( W|indowPtr|
|000014f0| 20 77 69 6e 64 6f 77 20 | 29 3b 09 09 09 09 09 09 | window |);......|
|00001500| 09 09 3c 4d 43 3e 20 2a | 2f 0d 0d 76 6f 69 64 20 |..<MC> *|/..void |
|00001510| 44 72 61 77 57 69 6e 64 | 6f 77 28 20 57 69 6e 64 |DrawWind|ow( Wind|
|00001520| 6f 77 50 74 72 20 77 69 | 6e 64 6f 77 20 29 3b 0d |owPtr wi|ndow );.|
|00001530| 76 6f 69 64 20 41 64 6a | 75 73 74 4d 65 6e 75 73 |void Adj|ustMenus|
|00001540| 28 20 76 6f 69 64 20 29 | 3b 0d 76 6f 69 64 20 44 |( void )|;.void D|
|00001550| 6f 4d 65 6e 75 43 6f 6d | 6d 61 6e 64 28 20 6c 6f |oMenuCom|mand( lo|
|00001560| 6e 67 20 6d 65 6e 75 52 | 65 73 75 6c 74 20 29 3b |ng menuR|esult );|
|00001570| 0d 42 6f 6f 6c 65 61 6e | 20 44 6f 43 6c 6f 73 65 |.Boolean| DoClose|
|00001580| 57 69 6e 64 6f 77 28 20 | 57 69 6e 64 6f 77 50 74 |Window( |WindowPt|
|00001590| 72 20 77 69 6e 64 6f 77 | 20 29 3b 0d 76 6f 69 64 |r window| );.void|
|000015a0| 20 54 65 72 6d 69 6e 61 | 74 65 28 20 76 6f 69 64 | Termina|te( void|
|000015b0| 20 29 3b 0d 76 6f 69 64 | 20 49 6e 69 74 69 61 6c | );.void| Initial|
|000015c0| 69 7a 65 28 20 76 6f 69 | 64 20 29 3b 0d 42 6f 6f |ize( voi|d );.Boo|
|000015d0| 6c 65 61 6e 20 47 6f 47 | 65 74 52 65 63 74 28 20 |lean GoG|etRect( |
|000015e0| 73 68 6f 72 74 20 72 65 | 63 74 49 44 2c 20 52 65 |short re|ctID, Re|
|000015f0| 63 74 20 2a 74 68 65 52 | 65 63 74 20 29 3b 0d 76 |ct *theR|ect );.v|
|00001600| 6f 69 64 20 46 6f 72 63 | 65 45 6e 76 69 72 6f 6e |oid Forc|eEnviron|
|00001610| 73 28 20 76 6f 69 64 20 | 29 3b 0d 42 6f 6f 6c 65 |s( void |);.Boole|
|00001620| 61 6e 20 49 73 41 70 70 | 57 69 6e 64 6f 77 28 20 |an IsApp|Window( |
|00001630| 57 69 6e 64 6f 77 50 74 | 72 20 77 69 6e 64 6f 77 |WindowPt|r window|
|00001640| 20 29 3b 0d 42 6f 6f 6c | 65 61 6e 20 49 73 44 41 | );.Bool|ean IsDA|
|00001650| 57 69 6e 64 6f 77 28 20 | 57 69 6e 64 6f 77 50 74 |Window( |WindowPt|
|00001660| 72 20 77 69 6e 64 6f 77 | 20 29 3b 0d 42 6f 6f 6c |r window| );.Bool|
|00001670| 65 61 6e 20 54 72 61 70 | 41 76 61 69 6c 61 62 6c |ean Trap|Availabl|
|00001680| 65 28 20 73 68 6f 72 74 | 20 74 4e 75 6d 62 65 72 |e( short| tNumber|
|00001690| 2c 20 54 72 61 70 54 79 | 70 65 20 74 54 79 70 65 |, TrapTy|pe tType|
|000016a0| 20 29 3b 0d 76 6f 69 64 | 20 41 6c 65 72 74 55 73 | );.void| AlertUs|
|000016b0| 65 72 28 20 76 6f 69 64 | 20 29 3b 0d 0d 0d 2f 2a |er( void| );.../*|
|000016c0| 20 44 65 66 69 6e 65 20 | 48 69 57 72 64 20 61 6e | Define |HiWrd an|
|000016d0| 64 20 4c 6f 57 72 64 20 | 6d 61 63 72 6f 73 20 66 |d LoWrd |macros f|
|000016e0| 6f 72 20 65 66 66 69 63 | 69 65 6e 63 79 2e 20 2a |or effic|iency. *|
|000016f0| 2f 0d 23 64 65 66 69 6e | 65 20 48 69 57 72 64 28 |/.#defin|e HiWrd(|
|00001700| 61 4c 6f 6e 67 29 09 28 | 28 28 61 4c 6f 6e 67 29 |aLong).(|((aLong)|
|00001710| 20 3e 3e 20 31 36 29 20 | 26 20 30 78 46 46 46 46 | >> 16) |& 0xFFFF|
|00001720| 29 0d 23 64 65 66 69 6e | 65 20 4c 6f 57 72 64 28 |).#defin|e LoWrd(|
|00001730| 61 4c 6f 6e 67 29 09 28 | 28 61 4c 6f 6e 67 29 20 |aLong).(|(aLong) |
|00001740| 26 20 30 78 46 46 46 46 | 29 0d 0d 2f 2a 20 44 65 |& 0xFFFF|)../* De|
|00001750| 66 69 6e 65 20 54 6f 70 | 4c 65 66 74 20 61 6e 64 |fine Top|Left and|
|00001760| 20 42 6f 74 52 69 67 68 | 74 20 6d 61 63 72 6f 73 | BotRigh|t macros|
|00001770| 20 66 6f 72 20 63 6f 6e | 76 65 6e 69 65 6e 63 65 | for con|venience|
|00001780| 2e 20 4e 6f 74 69 63 65 | 20 74 68 65 20 69 6d 70 |. Notice| the imp|
|00001790| 6c 69 63 69 74 0d 20 20 | 20 64 65 70 65 6e 64 65 |licit. | depende|
|000017a0| 6e 63 79 20 6f 6e 20 74 | 68 65 20 6f 72 64 65 72 |ncy on t|he order|
|000017b0| 69 6e 67 20 6f 66 20 66 | 69 65 6c 64 73 20 77 69 |ing of f|ields wi|
|000017c0| 74 68 69 6e 20 61 20 52 | 65 63 74 20 2a 2f 0d 23 |thin a R|ect */.#|
|000017d0| 64 65 66 69 6e 65 20 54 | 6f 70 4c 65 66 74 28 61 |define T|opLeft(a|
|000017e0| 52 65 63 74 29 09 28 2a | 20 28 50 6f 69 6e 74 20 |Rect).(*| (Point |
|000017f0| 2a 29 20 26 28 61 52 65 | 63 74 29 2e 74 6f 70 29 |*) &(aRe|ct).top)|
|00001800| 0d 23 64 65 66 69 6e 65 | 20 42 6f 74 52 69 67 68 |.#define| BotRigh|
|00001810| 74 28 61 52 65 63 74 29 | 09 28 2a 20 28 50 6f 69 |t(aRect)|.(* (Poi|
|00001820| 6e 74 20 2a 29 20 26 28 | 61 52 65 63 74 29 2e 62 |nt *) &(|aRect).b|
|00001830| 6f 74 74 6f 6d 29 0d 0d | 0d 23 69 66 64 65 66 20 |ottom)..|.#ifdef |
|00001840| 61 70 70 6c 65 63 0d 65 | 78 74 65 72 6e 20 76 6f |applec.e|xtern vo|
|00001850| 69 64 20 5f 44 61 74 61 | 49 6e 69 74 28 29 3b 0d |id _Data|Init();.|
|00001860| 23 65 6e 64 69 66 20 61 | 70 70 6c 65 63 0d 0d 2f |#endif a|pplec../|
|00001870| 2a 20 54 68 69 73 20 72 | 6f 75 74 69 6e 65 20 69 |* This r|outine i|
|00001880| 73 20 70 61 72 74 20 6f | 66 20 74 68 65 20 4d 50 |s part o|f the MP|
|00001890| 57 20 72 75 6e 74 69 6d | 65 20 6c 69 62 72 61 72 |W runtim|e librar|
|000018a0| 79 2e 20 54 68 69 73 20 | 65 78 74 65 72 6e 61 6c |y. This |external|
|000018b0| 0d 20 20 20 72 65 66 65 | 72 65 6e 63 65 20 74 6f |. refe|rence to|
|000018c0| 20 69 74 20 69 73 20 64 | 6f 6e 65 20 73 6f 20 74 | it is d|one so t|
|000018d0| 68 61 74 20 77 65 20 63 | 61 6e 20 75 6e 6c 6f 61 |hat we c|an unloa|
|000018e0| 64 20 69 74 73 20 73 65 | 67 6d 65 6e 74 2c 20 25 |d its se|gment, %|
|000018f0| 41 35 49 6e 69 74 2e 20 | 2a 2f 0d 0d 0d 23 70 72 |A5Init. |*/...#pr|
|00001900| 61 67 6d 61 20 73 65 67 | 6d 65 6e 74 20 4d 61 69 |agma seg|ment Mai|
|00001910| 6e 0d 6d 61 69 6e 28 29 | 0d 7b 0d 09 23 69 66 64 |n.main()|.{..#ifd|
|00001920| 65 66 20 61 70 70 6c 65 | 63 0d 09 55 6e 6c 6f 61 |ef apple|c..Unloa|
|00001930| 64 53 65 67 28 28 50 74 | 72 29 20 5f 44 61 74 61 |dSeg((Pt|r) _Data|
|00001940| 49 6e 69 74 29 3b 09 09 | 2f 2a 20 6e 6f 74 65 20 |Init);..|/* note |
|00001950| 74 68 61 74 20 5f 44 61 | 74 61 49 6e 69 74 20 6d |that _Da|taInit m|
|00001960| 75 73 74 20 6e 6f 74 20 | 62 65 20 69 6e 20 4d 61 |ust not |be in Ma|
|00001970| 69 6e 21 20 2a 2f 0d 09 | 23 65 6e 64 69 66 20 61 |in! */..|#endif a|
|00001980| 70 70 6c 65 63 0d 09 0d | 09 2f 2a 20 31 2e 30 31 |pplec...|./* 1.01|
|00001990| 20 2d 20 63 61 6c 6c 20 | 74 6f 20 46 6f 72 63 65 | - call |to Force|
|000019a0| 45 6e 76 69 72 6f 6e 73 | 20 72 65 6d 6f 76 65 64 |Environs| removed|
|000019b0| 20 2a 2f 0d 09 0d 09 2f | 2a 09 49 66 20 79 6f 75 | */..../|*.If you|
|000019c0| 20 68 61 76 65 20 73 74 | 61 63 6b 20 72 65 71 75 | have st|ack requ|
|000019d0| 69 72 65 6d 65 6e 74 73 | 20 74 68 61 74 20 64 69 |irements| that di|
|000019e0| 66 66 65 72 20 66 72 6f | 6d 20 74 68 65 20 64 65 |ffer fro|m the de|
|000019f0| 66 61 75 6c 74 2c 0d 09 | 09 74 68 65 6e 20 79 6f |fault,..|.then yo|
|00001a00| 75 20 63 6f 75 6c 64 20 | 75 73 65 20 53 65 74 41 |u could |use SetA|
|00001a10| 70 70 6c 4c 69 6d 69 74 | 20 74 6f 20 69 6e 63 72 |pplLimit| to incr|
|00001a20| 65 61 73 65 20 53 74 61 | 63 6b 53 70 61 63 65 20 |ease Sta|ckSpace |
|00001a30| 61 74 20 0d 09 09 74 68 | 69 73 20 70 6f 69 6e 74 |at ...th|is point|
|00001a40| 2c 20 62 65 66 6f 72 65 | 20 63 61 6c 6c 69 6e 67 |, before| calling|
|00001a50| 20 4d 61 78 41 70 70 6c | 5a 6f 6e 65 2e 20 2a 2f | MaxAppl|Zone. */|
|00001a60| 0d 09 4d 61 78 41 70 70 | 6c 5a 6f 6e 65 28 29 3b |..MaxApp|lZone();|
|00001a70| 09 09 09 09 09 2f 2a 20 | 65 78 70 61 6e 64 20 74 |...../* |expand t|
|00001a80| 68 65 20 68 65 61 70 20 | 73 6f 20 63 6f 64 65 20 |he heap |so code |
|00001a90| 73 65 67 6d 65 6e 74 73 | 20 6c 6f 61 64 20 61 74 |segments| load at|
|00001aa0| 20 74 68 65 20 74 6f 70 | 20 2a 2f 0d 0d 09 49 6e | the top| */...In|
|00001ab0| 69 74 69 61 6c 69 7a 65 | 28 29 3b 09 09 09 09 09 |itialize|();.....|
|00001ac0| 2f 2a 20 69 6e 69 74 69 | 61 6c 69 7a 65 20 74 68 |/* initi|alize th|
|00001ad0| 65 20 70 72 6f 67 72 61 | 6d 20 2a 2f 0d 0d 09 23 |e progra|m */...#|
|00001ae0| 69 66 64 65 66 20 61 70 | 70 6c 65 63 0d 09 55 6e |ifdef ap|plec..Un|
|00001af0| 6c 6f 61 64 53 65 67 28 | 28 50 74 72 29 20 49 6e |loadSeg(|(Ptr) In|
|00001b00| 69 74 69 61 6c 69 7a 65 | 29 3b 09 2f 2a 20 6e 6f |itialize|);./* no|
|00001b10| 74 65 20 74 68 61 74 20 | 49 6e 69 74 69 61 6c 69 |te that |Initiali|
|00001b20| 7a 65 20 6d 75 73 74 20 | 6e 6f 74 20 62 65 20 69 |ze must |not be i|
|00001b30| 6e 20 4d 61 69 6e 21 20 | 2a 2f 0d 09 23 65 6e 64 |n Main! |*/..#end|
|00001b40| 69 66 20 61 70 70 6c 65 | 63 0d 0d 09 45 76 65 6e |if apple|c...Even|
|00001b50| 74 4c 6f 6f 70 28 29 3b | 09 09 09 09 09 2f 2a 20 |tLoop();|...../* |
|00001b60| 63 61 6c 6c 20 74 68 65 | 20 6d 61 69 6e 20 65 76 |call the| main ev|
|00001b70| 65 6e 74 20 6c 6f 6f 70 | 20 2a 2f 0d 09 0d 09 43 |ent loop| */....C|
|00001b80| 6c 65 61 6e 55 70 33 44 | 20 28 29 3b 09 09 09 09 |leanUp3D| ();....|
|00001b90| 09 2f 2a 20 3c 4d 43 3e | 20 2a 2f 0d 7d 0d 0d 0d |./* <MC>| */.}...|
|00001ba0| 2f 2a 09 47 65 74 20 65 | 76 65 6e 74 73 20 66 6f |/*.Get e|vents fo|
|00001bb0| 72 65 76 65 72 2c 20 61 | 6e 64 20 68 61 6e 64 6c |rever, a|nd handl|
|00001bc0| 65 20 74 68 65 6d 20 62 | 79 20 63 61 6c 6c 69 6e |e them b|y callin|
|00001bd0| 67 20 44 6f 45 76 65 6e | 74 2e 0d 09 47 65 74 20 |g DoEven|t...Get |
|00001be0| 74 68 65 20 65 76 65 6e | 74 73 20 62 79 20 63 61 |the even|ts by ca|
|00001bf0| 6c 6c 69 6e 67 20 57 61 | 69 74 4e 65 78 74 45 76 |lling Wa|itNextEv|
|00001c00| 65 6e 74 2c 20 69 66 20 | 69 74 27 73 20 61 76 61 |ent, if |it's ava|
|00001c10| 69 6c 61 62 6c 65 2c 20 | 6f 74 68 65 72 77 69 73 |ilable, |otherwis|
|00001c20| 65 0d 09 62 79 20 63 61 | 6c 6c 69 6e 67 20 47 65 |e..by ca|lling Ge|
|00001c30| 74 4e 65 78 74 45 76 65 | 6e 74 2e 20 41 6c 73 6f |tNextEve|nt. Also|
|00001c40| 20 63 61 6c 6c 20 41 64 | 6a 75 73 74 43 75 72 73 | call Ad|justCurs|
|00001c50| 6f 72 20 65 61 63 68 20 | 74 69 6d 65 20 74 68 72 |or each |time thr|
|00001c60| 6f 75 67 68 20 74 68 65 | 20 6c 6f 6f 70 2e 20 2a |ough the| loop. *|
|00001c70| 2f 0d 0d 23 70 72 61 67 | 6d 61 20 73 65 67 6d 65 |/..#prag|ma segme|
|00001c80| 6e 74 20 4d 61 69 6e 0d | 76 6f 69 64 20 45 76 65 |nt Main.|void Eve|
|00001c90| 6e 74 4c 6f 6f 70 28 29 | 0d 7b 0d 09 52 67 6e 48 |ntLoop()|.{..RgnH|
|00001ca0| 61 6e 64 6c 65 09 63 75 | 72 73 6f 72 52 67 6e 3b |andle.cu|rsorRgn;|
|00001cb0| 0d 09 42 6f 6f 6c 65 61 | 6e 09 09 67 6f 74 45 76 |..Boolea|n..gotEv|
|00001cc0| 65 6e 74 3b 0d 09 45 76 | 65 6e 74 52 65 63 6f 72 |ent;..Ev|entRecor|
|00001cd0| 64 09 65 76 65 6e 74 3b | 0d 09 50 6f 69 6e 74 09 |d.event;|..Point.|
|00001ce0| 09 6d 6f 75 73 65 3b 0d | 0d 09 63 75 72 73 6f 72 |.mouse;.|..cursor|
|00001cf0| 52 67 6e 20 3d 20 4e 65 | 77 52 67 6e 28 29 3b 09 |Rgn = Ne|wRgn();.|
|00001d00| 09 09 2f 2a 20 77 65 d5 | 6c 6c 20 70 61 73 73 20 |../* we.|ll pass |
|00001d10| 57 4e 45 20 61 6e 20 65 | 6d 70 74 79 20 72 65 67 |WNE an e|mpty reg|
|00001d20| 69 6f 6e 20 74 68 65 20 | 31 73 74 20 74 69 6d 65 |ion the |1st time|
|00001d30| 20 74 68 72 75 20 2a 2f | 0d 09 64 6f 20 7b 0d 09 | thru */|..do {..|
|00001d40| 09 2f 2a 20 75 73 65 20 | 57 4e 45 20 69 66 20 69 |./* use |WNE if i|
|00001d50| 74 20 69 73 20 61 76 61 | 69 6c 61 62 6c 65 20 2a |t is ava|ilable *|
|00001d60| 2f 0d 09 09 69 66 20 28 | 20 67 48 61 73 57 61 69 |/...if (| gHasWai|
|00001d70| 74 4e 65 78 74 45 76 65 | 6e 74 20 29 20 7b 0d 09 |tNextEve|nt ) {..|
|00001d80| 09 09 47 65 74 47 6c 6f | 62 61 6c 4d 6f 75 73 65 |..GetGlo|balMouse|
|00001d90| 28 26 6d 6f 75 73 65 29 | 3b 0d 09 09 09 41 64 6a |(&mouse)|;....Adj|
|00001da0| 75 73 74 43 75 72 73 6f | 72 28 6d 6f 75 73 65 2c |ustCurso|r(mouse,|
|00001db0| 20 63 75 72 73 6f 72 52 | 67 6e 29 3b 0d 09 09 09 | cursorR|gn);....|
|00001dc0| 67 6f 74 45 76 65 6e 74 | 20 3d 20 57 61 69 74 4e |gotEvent| = WaitN|
|00001dd0| 65 78 74 45 76 65 6e 74 | 28 65 76 65 72 79 45 76 |extEvent|(everyEv|
|00001de0| 65 6e 74 2c 20 26 65 76 | 65 6e 74 2c 20 4d 41 58 |ent, &ev|ent, MAX|
|00001df0| 4c 4f 4e 47 2c 20 63 75 | 72 73 6f 72 52 67 6e 29 |LONG, cu|rsorRgn)|
|00001e00| 3b 0d 09 09 7d 0d 09 09 | 65 6c 73 65 20 7b 0d 09 |;...}...|else {..|
|00001e10| 09 09 53 79 73 74 65 6d | 54 61 73 6b 28 29 3b 0d |..System|Task();.|
|00001e20| 09 09 09 67 6f 74 45 76 | 65 6e 74 20 3d 20 47 65 |...gotEv|ent = Ge|
|00001e30| 74 4e 65 78 74 45 76 65 | 6e 74 28 65 76 65 72 79 |tNextEve|nt(every|
|00001e40| 45 76 65 6e 74 2c 20 26 | 65 76 65 6e 74 29 3b 0d |Event, &|event);.|
|00001e50| 09 09 7d 0d 09 09 69 66 | 20 28 20 67 6f 74 45 76 |..}...if| ( gotEv|
|00001e60| 65 6e 74 20 29 20 7b 0d | 09 09 09 2f 2a 20 6d 61 |ent ) {.|.../* ma|
|00001e70| 6b 65 20 73 75 72 65 20 | 77 65 20 68 61 76 65 20 |ke sure |we have |
|00001e80| 74 68 65 20 72 69 67 68 | 74 20 63 75 72 73 6f 72 |the righ|t cursor|
|00001e90| 20 62 65 66 6f 72 65 20 | 68 61 6e 64 6c 69 6e 67 | before |handling|
|00001ea0| 20 74 68 65 20 65 76 65 | 6e 74 20 2a 2f 0d 09 09 | the eve|nt */...|
|00001eb0| 09 41 64 6a 75 73 74 43 | 75 72 73 6f 72 28 65 76 |.AdjustC|ursor(ev|
|00001ec0| 65 6e 74 2e 77 68 65 72 | 65 2c 20 63 75 72 73 6f |ent.wher|e, curso|
|00001ed0| 72 52 67 6e 29 3b 0d 09 | 09 09 44 6f 45 76 65 6e |rRgn);..|..DoEven|
|00001ee0| 74 28 26 65 76 65 6e 74 | 29 3b 0d 09 09 7d 0d 09 |t(&event|);...}..|
|00001ef0| 09 2f 2a 09 49 66 20 79 | 6f 75 20 61 72 65 20 75 |./*.If y|ou are u|
|00001f00| 73 69 6e 67 20 6d 6f 64 | 65 6c 65 73 73 20 64 69 |sing mod|eless di|
|00001f10| 61 6c 6f 67 73 20 74 68 | 61 74 20 68 61 76 65 20 |alogs th|at have |
|00001f20| 65 64 69 74 54 65 78 74 | 20 69 74 65 6d 73 2c 0d |editText| items,.|
|00001f30| 09 09 09 79 6f 75 20 77 | 69 6c 6c 20 77 61 6e 74 |...you w|ill want|
|00001f40| 20 74 6f 20 63 61 6c 6c | 20 49 73 44 69 61 6c 6f | to call| IsDialo|
|00001f50| 67 45 76 65 6e 74 20 74 | 6f 20 67 69 76 65 20 74 |gEvent t|o give t|
|00001f60| 68 65 20 63 61 72 65 74 | 20 61 20 63 68 61 6e 63 |he caret| a chanc|
|00001f70| 65 0d 09 09 09 74 6f 20 | 62 6c 69 6e 6b 2c 20 65 |e....to |blink, e|
|00001f80| 76 65 6e 20 69 66 20 57 | 4e 45 2f 47 4e 45 20 72 |ven if W|NE/GNE r|
|00001f90| 65 74 75 72 6e 65 64 20 | 46 41 4c 53 45 2e 20 48 |eturned |FALSE. H|
|00001fa0| 6f 77 65 76 65 72 2c 20 | 63 68 65 63 6b 20 46 72 |owever, |check Fr|
|00001fb0| 6f 6e 74 57 69 6e 64 6f | 77 0d 09 09 09 66 6f 72 |ontWindo|w....for|
|00001fc0| 20 61 20 6e 6f 6e 2d 4e | 49 4c 20 76 61 6c 75 65 | a non-N|IL value|
|00001fd0| 20 62 65 66 6f 72 65 20 | 63 61 6c 6c 69 6e 67 20 | before |calling |
|00001fe0| 49 73 44 69 61 6c 6f 67 | 45 76 65 6e 74 2e 20 2a |IsDialog|Event. *|
|00001ff0| 2f 0d 09 7d 20 77 68 69 | 6c 65 20 28 20 74 72 75 |/..} whi|le ( tru|
|00002000| 65 20 29 3b 09 2f 2a 20 | 6c 6f 6f 70 20 66 6f 72 |e );./* |loop for|
|00002010| 65 76 65 72 3b 20 77 65 | 20 71 75 69 74 20 76 69 |ever; we| quit vi|
|00002020| 61 20 45 78 69 74 54 6f | 53 68 65 6c 6c 20 2a 2f |a ExitTo|Shell */|
|00002030| 0d 7d 20 2f 2a 45 76 65 | 6e 74 4c 6f 6f 70 2a 2f |.} /*Eve|ntLoop*/|
|00002040| 0d 0d 0d 2f 2a 20 44 6f | 20 74 68 65 20 72 69 67 |.../* Do| the rig|
|00002050| 68 74 20 74 68 69 6e 67 | 20 66 6f 72 20 61 6e 20 |ht thing| for an |
|00002060| 65 76 65 6e 74 2e 20 44 | 65 74 65 72 6d 69 6e 65 |event. D|etermine|
|00002070| 20 77 68 61 74 20 6b 69 | 6e 64 20 6f 66 20 65 76 | what ki|nd of ev|
|00002080| 65 6e 74 20 69 74 20 69 | 73 2c 20 61 6e 64 20 63 |ent it i|s, and c|
|00002090| 61 6c 6c 0d 20 74 68 65 | 20 61 70 70 72 6f 70 72 |all. the| appropr|
|000020a0| 69 61 74 65 20 72 6f 75 | 74 69 6e 65 73 2e 20 2a |iate rou|tines. *|
|000020b0| 2f 0d 0d 23 70 72 61 67 | 6d 61 20 73 65 67 6d 65 |/..#prag|ma segme|
|000020c0| 6e 74 20 4d 61 69 6e 0d | 76 6f 69 64 20 44 6f 45 |nt Main.|void DoE|
|000020d0| 76 65 6e 74 28 65 76 65 | 6e 74 29 0d 09 45 76 65 |vent(eve|nt)..Eve|
|000020e0| 6e 74 52 65 63 6f 72 64 | 09 2a 65 76 65 6e 74 3b |ntRecord|.*event;|
|000020f0| 0d 7b 0d 09 73 68 6f 72 | 74 09 09 70 61 72 74 2c |.{..shor|t..part,|
|00002100| 20 65 72 72 3b 0d 09 57 | 69 6e 64 6f 77 50 74 72 | err;..W|indowPtr|
|00002110| 09 77 69 6e 64 6f 77 3b | 0d 09 42 6f 6f 6c 65 61 |.window;|..Boolea|
|00002120| 6e 09 09 68 69 74 3b 0d | 09 63 68 61 72 09 09 6b |n..hit;.|.char..k|
|00002130| 65 79 3b 0d 09 50 6f 69 | 6e 74 09 09 61 50 6f 69 |ey;..Poi|nt..aPoi|
|00002140| 6e 74 3b 0d 0d 09 73 77 | 69 74 63 68 20 28 20 65 |nt;...sw|itch ( e|
|00002150| 76 65 6e 74 2d 3e 77 68 | 61 74 20 29 20 7b 0d 09 |vent->wh|at ) {..|
|00002160| 09 63 61 73 65 20 6d 6f | 75 73 65 44 6f 77 6e 3a |.case mo|useDown:|
|00002170| 0d 09 09 09 70 61 72 74 | 20 3d 20 46 69 6e 64 57 |....part| = FindW|
|00002180| 69 6e 64 6f 77 28 65 76 | 65 6e 74 2d 3e 77 68 65 |indow(ev|ent->whe|
|00002190| 72 65 2c 20 26 77 69 6e | 64 6f 77 29 3b 0d 09 09 |re, &win|dow);...|
|000021a0| 09 73 77 69 74 63 68 20 | 28 20 70 61 72 74 20 29 |.switch |( part )|
|000021b0| 20 7b 0d 09 09 09 09 63 | 61 73 65 20 69 6e 4d 65 | {.....c|ase inMe|
|000021c0| 6e 75 42 61 72 3a 09 09 | 09 09 2f 2a 20 70 72 6f |nuBar:..|../* pro|
|000021d0| 63 65 73 73 20 61 20 6d | 6f 75 73 65 20 6d 65 6e |cess a m|ouse men|
|000021e0| 75 20 63 6f 6d 6d 61 6e | 64 20 28 69 66 20 61 6e |u comman|d (if an|
|000021f0| 79 29 20 2a 2f 0d 09 09 | 09 09 09 41 64 6a 75 73 |y) */...|...Adjus|
|00002200| 74 4d 65 6e 75 73 28 29 | 3b 0d 09 09 09 09 09 44 |tMenus()|;......D|
|00002210| 6f 4d 65 6e 75 43 6f 6d | 6d 61 6e 64 28 4d 65 6e |oMenuCom|mand(Men|
|00002220| 75 53 65 6c 65 63 74 28 | 65 76 65 6e 74 2d 3e 77 |uSelect(|event->w|
|00002230| 68 65 72 65 29 29 3b 0d | 09 09 09 09 09 62 72 65 |here));.|.....bre|
|00002240| 61 6b 3b 0d 09 09 09 09 | 63 61 73 65 20 69 6e 53 |ak;.....|case inS|
|00002250| 79 73 57 69 6e 64 6f 77 | 3a 09 09 09 2f 2a 20 6c |ysWindow|:.../* l|
|00002260| 65 74 20 74 68 65 20 73 | 79 73 74 65 6d 20 68 61 |et the s|ystem ha|
|00002270| 6e 64 6c 65 20 74 68 65 | 20 6d 6f 75 73 65 44 6f |ndle the| mouseDo|
|00002280| 77 6e 20 2a 2f 0d 09 09 | 09 09 09 53 79 73 74 65 |wn */...|...Syste|
|00002290| 6d 43 6c 69 63 6b 28 65 | 76 65 6e 74 2c 20 77 69 |mClick(e|vent, wi|
|000022a0| 6e 64 6f 77 29 3b 0d 09 | 09 09 09 09 62 72 65 61 |ndow);..|....brea|
|000022b0| 6b 3b 0d 09 09 09 09 63 | 61 73 65 20 69 6e 43 6f |k;.....c|ase inCo|
|000022c0| 6e 74 65 6e 74 3a 0d 09 | 09 09 09 09 69 66 20 28 |ntent:..|....if (|
|000022d0| 20 77 69 6e 64 6f 77 20 | 21 3d 20 46 72 6f 6e 74 | window |!= Front|
|000022e0| 57 69 6e 64 6f 77 28 29 | 20 29 20 7b 0d 09 09 09 |Window()| ) {....|
|000022f0| 09 09 09 53 65 6c 65 63 | 74 57 69 6e 64 6f 77 28 |...Selec|tWindow(|
|00002300| 77 69 6e 64 6f 77 29 3b | 0d 09 09 09 09 09 09 2f |window);|......./|
|00002310| 2a 44 6f 45 76 65 6e 74 | 28 65 76 65 6e 74 29 3b |*DoEvent|(event);|
|00002320| 2a 2f 09 2f 2a 20 75 73 | 65 20 74 68 69 73 20 6c |*/./* us|e this l|
|00002330| 69 6e 65 20 66 6f 72 20 | 22 64 6f 20 66 69 72 73 |ine for |"do firs|
|00002340| 74 20 63 6c 69 63 6b 22 | 20 2a 2f 0d 09 09 09 09 |t click"| */.....|
|00002350| 09 7d 20 65 6c 73 65 0d | 09 09 09 09 09 09 44 6f |.} else.|......Do|
|00002360| 43 6f 6e 74 65 6e 74 43 | 6c 69 63 6b 28 77 69 6e |ContentC|lick(win|
|00002370| 64 6f 77 2c 20 65 76 65 | 6e 74 29 3b 09 09 2f 2a |dow, eve|nt);../*|
|00002380| 20 3c 4d 43 3e 20 2a 2f | 0d 09 09 09 09 09 62 72 | <MC> */|......br|
|00002390| 65 61 6b 3b 0d 09 09 09 | 09 63 61 73 65 20 69 6e |eak;....|.case in|
|000023a0| 44 72 61 67 3a 09 09 09 | 09 2f 2a 20 70 61 73 73 |Drag:...|./* pass|
|000023b0| 20 73 63 72 65 65 6e 42 | 69 74 73 2e 62 6f 75 6e | screenB|its.boun|
|000023c0| 64 73 20 74 6f 20 67 65 | 74 20 61 6c 6c 20 67 44 |ds to ge|t all gD|
|000023d0| 65 76 69 63 65 73 20 2a | 2f 0d 09 09 09 09 09 44 |evices *|/......D|
|000023e0| 72 61 67 57 69 6e 64 6f | 77 28 77 69 6e 64 6f 77 |ragWindo|w(window|
|000023f0| 2c 20 65 76 65 6e 74 2d | 3e 77 68 65 72 65 2c 20 |, event-|>where, |
|00002400| 26 71 64 2e 73 63 72 65 | 65 6e 42 69 74 73 2e 62 |&qd.scre|enBits.b|
|00002410| 6f 75 6e 64 73 29 3b 0d | 09 09 09 09 09 49 6e 76 |ounds);.|.....Inv|
|00002420| 61 6c 52 65 63 74 28 26 | 77 69 6e 64 6f 77 2d 3e |alRect(&|window->|
|00002430| 70 6f 72 74 52 65 63 74 | 29 3b 09 2f 2a 20 43 61 |portRect|);./* Ca|
|00002440| 75 73 65 73 20 61 20 63 | 68 65 63 6b 20 74 6f 20 |uses a c|heck to |
|00002450| 73 65 65 20 69 66 20 47 | 57 6f 72 6c 64 20 6e 65 |see if G|World ne|
|00002460| 65 64 73 20 74 6f 20 62 | 65 20 72 65 61 6c 6c 6f |eds to b|e reallo|
|00002470| 63 61 74 65 64 20 3c 4d | 43 3e 20 2a 2f 0d 09 09 |cated <M|C> */...|
|00002480| 09 09 09 62 72 65 61 6b | 3b 0d 09 09 09 09 63 61 |...break|;.....ca|
|00002490| 73 65 20 69 6e 47 72 6f | 77 3a 0d 09 09 09 09 09 |se inGro|w:......|
|000024a0| 49 6e 76 61 6c 52 65 63 | 74 28 26 77 69 6e 64 6f |InvalRec|t(&windo|
|000024b0| 77 2d 3e 70 6f 72 74 52 | 65 63 74 29 3b 09 2f 2a |w->portR|ect);./*|
|000024c0| 20 43 61 75 73 65 73 20 | 61 20 63 68 65 63 6b 20 | Causes |a check |
|000024d0| 74 6f 20 73 65 65 20 69 | 66 20 47 57 6f 72 6c 64 |to see i|f GWorld|
|000024e0| 20 6e 65 65 64 73 20 74 | 6f 20 62 65 20 72 65 61 | needs t|o be rea|
|000024f0| 6c 6c 6f 63 61 74 65 64 | 20 3c 4d 43 3e 20 2a 2f |llocated| <MC> */|
|00002500| 0d 09 09 09 09 09 62 72 | 65 61 6b 3b 0d 09 09 09 |......br|eak;....|
|00002510| 09 63 61 73 65 20 69 6e | 5a 6f 6f 6d 49 6e 3a 0d |.case in|ZoomIn:.|
|00002520| 09 09 09 09 63 61 73 65 | 20 69 6e 5a 6f 6f 6d 4f |....case| inZoomO|
|00002530| 75 74 3a 0d 09 09 09 09 | 09 68 69 74 20 3d 20 54 |ut:.....|.hit = T|
|00002540| 72 61 63 6b 42 6f 78 28 | 77 69 6e 64 6f 77 2c 20 |rackBox(|window, |
|00002550| 65 76 65 6e 74 2d 3e 77 | 68 65 72 65 2c 20 70 61 |event->w|here, pa|
|00002560| 72 74 29 3b 0d 09 09 09 | 09 09 69 66 20 28 20 68 |rt);....|..if ( h|
|00002570| 69 74 20 29 20 7b 0d 09 | 09 09 09 09 09 53 65 74 |it ) {..|.....Set|
|00002580| 50 6f 72 74 28 77 69 6e | 64 6f 77 29 3b 09 09 09 |Port(win|dow);...|
|00002590| 09 2f 2a 20 74 68 65 20 | 77 69 6e 64 6f 77 20 6d |./* the |window m|
|000025a0| 75 73 74 20 62 65 20 74 | 68 65 20 63 75 72 72 65 |ust be t|he curre|
|000025b0| 6e 74 20 70 6f 72 74 2e | 2e 2e 20 2a 2f 0d 09 09 |nt port.|.. */...|
|000025c0| 09 09 09 09 45 72 61 73 | 65 52 65 63 74 28 26 77 |....Eras|eRect(&w|
|000025d0| 69 6e 64 6f 77 2d 3e 70 | 6f 72 74 52 65 63 74 29 |indow->p|ortRect)|
|000025e0| 3b 09 2f 2a 20 62 65 63 | 61 75 73 65 20 6f 66 20 |;./* bec|ause of |
|000025f0| 61 20 62 75 67 20 69 6e | 20 5a 6f 6f 6d 57 69 6e |a bug in| ZoomWin|
|00002600| 64 6f 77 20 2a 2f 0d 09 | 09 09 09 09 09 5a 6f 6f |dow */..|.....Zoo|
|00002610| 6d 57 69 6e 64 6f 77 28 | 77 69 6e 64 6f 77 2c 20 |mWindow(|window, |
|00002620| 70 61 72 74 2c 20 74 72 | 75 65 29 3b 09 2f 2a 20 |part, tr|ue);./* |
|00002630| 6e 6f 74 65 20 74 68 61 | 74 20 77 65 20 69 6e 76 |note tha|t we inv|
|00002640| 61 6c 69 64 61 74 65 20 | 61 6e 64 20 65 72 61 73 |alidate |and eras|
|00002650| 65 2e 2e 2e 20 2a 2f 0d | 09 09 09 09 09 09 49 6e |e... */.|......In|
|00002660| 76 61 6c 52 65 63 74 28 | 26 77 69 6e 64 6f 77 2d |valRect(|&window-|
|00002670| 3e 70 6f 72 74 52 65 63 | 74 29 3b 09 2f 2a 20 74 |>portRec|t);./* t|
|00002680| 6f 20 6d 61 6b 65 20 74 | 68 69 6e 67 73 20 6c 6f |o make t|hings lo|
|00002690| 6f 6b 20 62 65 74 74 65 | 72 20 6f 6e 2d 73 63 72 |ok bette|r on-scr|
|000026a0| 65 65 6e 20 2a 2f 0d 09 | 09 09 09 09 7d 0d 09 09 |een */..|....}...|
|000026b0| 09 09 09 62 72 65 61 6b | 3b 0d 09 09 09 7d 0d 09 |...break|;....}..|
|000026c0| 09 09 62 72 65 61 6b 3b | 0d 09 09 63 61 73 65 20 |..break;|...case |
|000026d0| 6b 65 79 44 6f 77 6e 3a | 0d 09 09 63 61 73 65 20 |keyDown:|...case |
|000026e0| 61 75 74 6f 4b 65 79 3a | 09 09 09 09 09 09 2f 2a |autoKey:|....../*|
|000026f0| 20 63 68 65 63 6b 20 66 | 6f 72 20 6d 65 6e 75 6b | check f|or menuk|
|00002700| 65 79 20 65 71 75 69 76 | 61 6c 65 6e 74 73 20 2a |ey equiv|alents *|
|00002710| 2f 0d 09 09 09 6b 65 79 | 20 3d 20 65 76 65 6e 74 |/....key| = event|
|00002720| 2d 3e 6d 65 73 73 61 67 | 65 20 26 20 63 68 61 72 |->messag|e & char|
|00002730| 43 6f 64 65 4d 61 73 6b | 3b 0d 09 09 09 69 66 20 |CodeMask|;....if |
|00002740| 28 20 65 76 65 6e 74 2d | 3e 6d 6f 64 69 66 69 65 |( event-|>modifie|
|00002750| 72 73 20 26 20 63 6d 64 | 4b 65 79 20 29 09 09 09 |rs & cmd|Key )...|
|00002760| 2f 2a 20 43 6f 6d 6d 61 | 6e 64 20 6b 65 79 20 64 |/* Comma|nd key d|
|00002770| 6f 77 6e 20 2a 2f 0d 09 | 09 09 09 69 66 20 28 20 |own */..|...if ( |
|00002780| 65 76 65 6e 74 2d 3e 77 | 68 61 74 20 3d 3d 20 6b |event->w|hat == k|
|00002790| 65 79 44 6f 77 6e 20 29 | 20 7b 0d 09 09 09 09 09 |eyDown )| {......|
|000027a0| 41 64 6a 75 73 74 4d 65 | 6e 75 73 28 29 3b 09 09 |AdjustMe|nus();..|
|000027b0| 09 09 09 09 2f 2a 20 65 | 6e 61 62 6c 65 2f 64 69 |..../* e|nable/di|
|000027c0| 73 61 62 6c 65 2f 63 68 | 65 63 6b 20 6d 65 6e 75 |sable/ch|eck menu|
|000027d0| 20 69 74 65 6d 73 20 70 | 72 6f 70 65 72 6c 79 20 | items p|roperly |
|000027e0| 2a 2f 0d 09 09 09 09 09 | 44 6f 4d 65 6e 75 43 6f |*/......|DoMenuCo|
|000027f0| 6d 6d 61 6e 64 28 4d 65 | 6e 75 4b 65 79 28 6b 65 |mmand(Me|nuKey(ke|
|00002800| 79 29 29 3b 0d 09 09 09 | 09 7d 0d 09 09 09 62 72 |y));....|.}....br|
|00002810| 65 61 6b 3b 0d 09 09 63 | 61 73 65 20 61 63 74 69 |eak;...c|ase acti|
|00002820| 76 61 74 65 45 76 74 3a | 0d 09 09 09 44 6f 41 63 |vateEvt:|....DoAc|
|00002830| 74 69 76 61 74 65 28 28 | 57 69 6e 64 6f 77 50 74 |tivate((|WindowPt|
|00002840| 72 29 20 65 76 65 6e 74 | 2d 3e 6d 65 73 73 61 67 |r) event|->messag|
|00002850| 65 2c 20 28 65 76 65 6e | 74 2d 3e 6d 6f 64 69 66 |e, (even|t->modif|
|00002860| 69 65 72 73 20 26 20 61 | 63 74 69 76 65 46 6c 61 |iers & a|ctiveFla|
|00002870| 67 29 20 21 3d 20 30 29 | 3b 0d 09 09 09 62 72 65 |g) != 0)|;....bre|
|00002880| 61 6b 3b 0d 09 09 63 61 | 73 65 20 75 70 64 61 74 |ak;...ca|se updat|
|00002890| 65 45 76 74 3a 0d 09 09 | 09 44 6f 55 70 64 61 74 |eEvt:...|.DoUpdat|
|000028a0| 65 28 28 57 69 6e 64 6f | 77 50 74 72 29 20 65 76 |e((Windo|wPtr) ev|
|000028b0| 65 6e 74 2d 3e 6d 65 73 | 73 61 67 65 29 3b 0d 09 |ent->mes|sage);..|
|000028c0| 09 09 62 72 65 61 6b 3b | 0d 09 09 2f 2a 09 31 2e |..break;|.../*.1.|
|000028d0| 30 31 20 2d 20 49 74 20 | 69 73 20 6e 6f 74 20 61 |01 - It |is not a|
|000028e0| 20 62 61 64 20 69 64 65 | 61 20 74 6f 20 61 74 20 | bad ide|a to at |
|000028f0| 6c 65 61 73 74 20 63 61 | 6c 6c 20 44 49 42 61 64 |least ca|ll DIBad|
|00002900| 4d 6f 75 6e 74 20 69 6e | 20 72 65 73 70 6f 6e 73 |Mount in| respons|
|00002910| 65 0d 09 09 09 74 6f 20 | 61 20 64 69 73 6b 45 76 |e....to |a diskEv|
|00002920| 74 2c 20 73 6f 20 74 68 | 61 74 20 74 68 65 20 75 |t, so th|at the u|
|00002930| 73 65 72 20 63 61 6e 20 | 66 6f 72 6d 61 74 20 61 |ser can |format a|
|00002940| 20 66 6c 6f 70 70 79 2e | 20 2a 2f 0d 09 09 63 61 | floppy.| */...ca|
|00002950| 73 65 20 64 69 73 6b 45 | 76 74 3a 0d 09 09 09 69 |se diskE|vt:....i|
|00002960| 66 20 28 20 48 69 57 6f | 72 64 28 65 76 65 6e 74 |f ( HiWo|rd(event|
|00002970| 2d 3e 6d 65 73 73 61 67 | 65 29 20 21 3d 20 6e 6f |->messag|e) != no|
|00002980| 45 72 72 20 29 20 7b 0d | 09 09 09 09 53 65 74 50 |Err ) {.|....SetP|
|00002990| 74 28 26 61 50 6f 69 6e | 74 2c 20 6b 44 49 4c 65 |t(&aPoin|t, kDILe|
|000029a0| 66 74 2c 20 6b 44 49 54 | 6f 70 29 3b 0d 09 09 09 |ft, kDIT|op);....|
|000029b0| 09 65 72 72 20 3d 20 44 | 49 42 61 64 4d 6f 75 6e |.err = D|IBadMoun|
|000029c0| 74 28 61 50 6f 69 6e 74 | 2c 20 65 76 65 6e 74 2d |t(aPoint|, event-|
|000029d0| 3e 6d 65 73 73 61 67 65 | 29 3b 0d 09 09 09 7d 0d |>message|);....}.|
|000029e0| 09 09 09 62 72 65 61 6b | 3b 0d 09 09 63 61 73 65 |...break|;...case|
|000029f0| 20 6b 4f 53 45 76 65 6e | 74 3a 0d 09 09 2f 2a 09 | kOSEven|t:.../*.|
|00002a00| 31 2e 30 32 20 2d 20 6d | 75 73 74 20 42 69 74 41 |1.02 - m|ust BitA|
|00002a10| 4e 44 20 77 69 74 68 20 | 30 78 30 46 46 20 74 6f |ND with |0x0FF to|
|00002a20| 20 67 65 74 20 6f 6e 6c | 79 20 6c 6f 77 20 62 79 | get onl|y low by|
|00002a30| 74 65 20 2a 2f 0d 09 09 | 09 73 77 69 74 63 68 20 |te */...|.switch |
|00002a40| 28 28 65 76 65 6e 74 2d | 3e 6d 65 73 73 61 67 65 |((event-|>message|
|00002a50| 20 3e 3e 20 32 34 29 20 | 26 20 30 78 30 46 46 29 | >> 24) |& 0x0FF)|
|00002a60| 20 7b 09 09 2f 2a 20 68 | 69 67 68 20 62 79 74 65 | {../* h|igh byte|
|00002a70| 20 6f 66 20 6d 65 73 73 | 61 67 65 20 2a 2f 0d 09 | of mess|age */..|
|00002a80| 09 09 09 63 61 73 65 20 | 6b 53 75 73 70 65 6e 64 |...case |kSuspend|
|00002a90| 52 65 73 75 6d 65 4d 65 | 73 73 61 67 65 3a 09 09 |ResumeMe|ssage:..|
|00002aa0| 2f 2a 20 73 75 73 70 65 | 6e 64 2f 72 65 73 75 6d |/* suspe|nd/resum|
|00002ab0| 65 20 69 73 20 61 6c 73 | 6f 20 61 6e 20 61 63 74 |e is als|o an act|
|00002ac0| 69 76 61 74 65 2f 64 65 | 61 63 74 69 76 61 74 65 |ivate/de|activate|
|00002ad0| 20 2a 2f 0d 09 09 09 09 | 09 67 49 6e 42 61 63 6b | */.....|.gInBack|
|00002ae0| 67 72 6f 75 6e 64 20 3d | 20 28 65 76 65 6e 74 2d |ground =| (event-|
|00002af0| 3e 6d 65 73 73 61 67 65 | 20 26 20 6b 52 65 73 75 |>message| & kResu|
|00002b00| 6d 65 4d 61 73 6b 29 20 | 3d 3d 20 30 3b 0d 09 09 |meMask) |== 0;...|
|00002b10| 09 09 09 44 6f 41 63 74 | 69 76 61 74 65 28 46 72 |...DoAct|ivate(Fr|
|00002b20| 6f 6e 74 57 69 6e 64 6f | 77 28 29 2c 20 21 67 49 |ontWindo|w(), !gI|
|00002b30| 6e 42 61 63 6b 67 72 6f | 75 6e 64 29 3b 0d 09 09 |nBackgro|und);...|
|00002b40| 09 09 09 62 72 65 61 6b | 3b 0d 09 09 09 7d 0d 09 |...break|;....}..|
|00002b50| 09 09 62 72 65 61 6b 3b | 0d 09 7d 0d 7d 20 2f 2a |..break;|..}.} /*|
|00002b60| 44 6f 45 76 65 6e 74 2a | 2f 0d 0d 0d 2f 2a 09 43 |DoEvent*|/.../*.C|
|00002b70| 68 61 6e 67 65 20 74 68 | 65 20 63 75 72 73 6f 72 |hange th|e cursor|
|00002b80| 27 73 20 73 68 61 70 65 | 2c 20 64 65 70 65 6e 64 |'s shape|, depend|
|00002b90| 69 6e 67 20 6f 6e 20 69 | 74 73 20 70 6f 73 69 74 |ing on i|ts posit|
|00002ba0| 69 6f 6e 2e 20 54 68 69 | 73 20 61 6c 73 6f 20 63 |ion. Thi|s also c|
|00002bb0| 61 6c 63 75 6c 61 74 65 | 73 20 74 68 65 20 72 65 |alculate|s the re|
|00002bc0| 67 69 6f 6e 0d 09 77 68 | 65 72 65 20 74 68 65 20 |gion..wh|ere the |
|00002bd0| 63 75 72 72 65 6e 74 20 | 63 75 72 73 6f 72 20 72 |current |cursor r|
|00002be0| 65 73 69 64 65 73 20 28 | 66 6f 72 20 57 61 69 74 |esides (|for Wait|
|00002bf0| 4e 65 78 74 45 76 65 6e | 74 29 2e 20 49 66 20 74 |NextEven|t). If t|
|00002c00| 68 65 20 6d 6f 75 73 65 | 20 69 73 20 65 76 65 72 |he mouse| is ever|
|00002c10| 20 6f 75 74 73 69 64 65 | 20 6f 66 0d 09 74 68 61 | outside| of..tha|
|00002c20| 74 20 72 65 67 69 6f 6e | 2c 20 61 6e 20 65 76 65 |t region|, an eve|
|00002c30| 6e 74 20 77 6f 75 6c 64 | 20 62 65 20 67 65 6e 65 |nt would| be gene|
|00002c40| 72 61 74 65 64 2c 20 63 | 61 75 73 69 6e 67 20 74 |rated, c|ausing t|
|00002c50| 68 69 73 20 72 6f 75 74 | 69 6e 65 20 74 6f 20 62 |his rout|ine to b|
|00002c60| 65 20 63 61 6c 6c 65 64 | 2c 0d 09 61 6c 6c 6f 77 |e called|,..allow|
|00002c70| 69 6e 67 20 75 73 20 74 | 6f 20 63 68 61 6e 67 65 |ing us t|o change|
|00002c80| 20 74 68 65 20 72 65 67 | 69 6f 6e 20 74 6f 20 74 | the reg|ion to t|
|00002c90| 68 65 20 72 65 67 69 6f | 6e 20 74 68 65 20 6d 6f |he regio|n the mo|
|00002ca0| 75 73 65 20 69 73 20 63 | 75 72 72 65 6e 74 6c 79 |use is c|urrently|
|00002cb0| 20 69 6e 2e 20 49 66 0d | 09 74 68 65 72 65 20 69 | in. If.|.there i|
|00002cc0| 73 20 6d 6f 72 65 20 74 | 6f 20 74 68 65 20 65 76 |s more t|o the ev|
|00002cd0| 65 6e 74 20 74 68 61 6e | 20 6a 75 73 74 20 d2 74 |ent than| just .t|
|00002ce0| 68 65 20 6d 6f 75 73 65 | 20 6d 6f 76 65 64 d3 2c |he mouse| moved.,|
|00002cf0| 20 77 65 20 67 65 74 20 | 63 61 6c 6c 65 64 20 62 | we get |called b|
|00002d00| 65 66 6f 72 65 20 74 68 | 65 0d 09 65 76 65 6e 74 |efore th|e..event|
|00002d10| 20 69 73 20 70 72 6f 63 | 65 73 73 65 64 20 74 6f | is proc|essed to|
|00002d20| 20 6d 61 6b 65 20 73 75 | 72 65 20 74 68 65 20 63 | make su|re the c|
|00002d30| 75 72 73 6f 72 20 69 73 | 20 74 68 65 20 72 69 67 |ursor is| the rig|
|00002d40| 68 74 20 6f 6e 65 2e 20 | 49 6e 20 61 6e 79 20 28 |ht one. |In any (|
|00002d50| 61 68 65 6d 29 20 65 76 | 65 6e 74 2c 0d 09 74 68 |ahem) ev|ent,..th|
|00002d60| 69 73 20 69 73 20 63 61 | 6c 6c 65 64 20 61 67 61 |is is ca|lled aga|
|00002d70| 69 6e 20 62 65 66 6f 72 | 65 20 77 65 20 09 66 61 |in befor|e we .fa|
|00002d80| 6c 6c 20 62 61 63 6b 20 | 69 6e 74 6f 20 57 4e 45 |ll back |into WNE|
|00002d90| 2e 20 2a 2f 0d 0d 23 70 | 72 61 67 6d 61 20 73 65 |. */..#p|ragma se|
|00002da0| 67 6d 65 6e 74 20 4d 61 | 69 6e 0d 76 6f 69 64 20 |gment Ma|in.void |
|00002db0| 41 64 6a 75 73 74 43 75 | 72 73 6f 72 28 6d 6f 75 |AdjustCu|rsor(mou|
|00002dc0| 73 65 2c 72 65 67 69 6f | 6e 29 0d 09 50 6f 69 6e |se,regio|n)..Poin|
|00002dd0| 74 09 09 6d 6f 75 73 65 | 3b 0d 09 52 67 6e 48 61 |t..mouse|;..RgnHa|
|00002de0| 6e 64 6c 65 09 72 65 67 | 69 6f 6e 3b 0d 7b 0d 09 |ndle.reg|ion;.{..|
|00002df0| 57 69 6e 64 6f 77 50 74 | 72 09 77 69 6e 64 6f 77 |WindowPt|r.window|
|00002e00| 3b 0d 09 52 67 6e 48 61 | 6e 64 6c 65 09 61 72 72 |;..RgnHa|ndle.arr|
|00002e10| 6f 77 52 67 6e 3b 0d 09 | 52 67 6e 48 61 6e 64 6c |owRgn;..|RgnHandl|
|00002e20| 65 09 70 6c 75 73 52 67 | 6e 3b 0d 09 52 65 63 74 |e.plusRg|n;..Rect|
|00002e30| 09 09 67 6c 6f 62 61 6c | 50 6f 72 74 52 65 63 74 |..global|PortRect|
|00002e40| 3b 0d 0d 09 77 69 6e 64 | 6f 77 20 3d 20 46 72 6f |;...wind|ow = Fro|
|00002e50| 6e 74 57 69 6e 64 6f 77 | 28 29 3b 09 2f 2a 20 77 |ntWindow|();./* w|
|00002e60| 65 20 6f 6e 6c 79 20 61 | 64 6a 75 73 74 20 74 68 |e only a|djust th|
|00002e70| 65 20 63 75 72 73 6f 72 | 20 77 68 65 6e 20 77 65 |e cursor| when we|
|00002e80| 20 61 72 65 20 69 6e 20 | 66 72 6f 6e 74 20 2a 2f | are in |front */|
|00002e90| 0d 09 69 66 20 28 20 28 | 21 20 67 49 6e 42 61 63 |..if ( (|! gInBac|
|00002ea0| 6b 67 72 6f 75 6e 64 29 | 20 26 26 20 28 21 20 49 |kground)| && (! I|
|00002eb0| 73 44 41 57 69 6e 64 6f | 77 28 77 69 6e 64 6f 77 |sDAWindo|w(window|
|00002ec0| 29 29 20 29 20 7b 0d 09 | 09 2f 2a 20 63 61 6c 63 |)) ) {..|./* calc|
|00002ed0| 75 6c 61 74 65 20 72 65 | 67 69 6f 6e 73 20 66 6f |ulate re|gions fo|
|00002ee0| 72 20 64 69 66 66 65 72 | 65 6e 74 20 63 75 72 73 |r differ|ent curs|
|00002ef0| 6f 72 20 73 68 61 70 65 | 73 20 2a 2f 0d 09 09 61 |or shape|s */...a|
|00002f00| 72 72 6f 77 52 67 6e 20 | 3d 20 4e 65 77 52 67 6e |rrowRgn |= NewRgn|
|00002f10| 28 29 3b 0d 09 09 70 6c | 75 73 52 67 6e 20 3d 20 |();...pl|usRgn = |
|00002f20| 4e 65 77 52 67 6e 28 29 | 3b 0d 0d 09 09 2f 2a 20 |NewRgn()|;..../* |
|00002f30| 73 74 61 72 74 20 77 69 | 74 68 20 61 20 62 69 67 |start wi|th a big|
|00002f40| 2c 20 62 69 67 20 72 65 | 63 74 61 6e 67 75 6c 61 |, big re|ctangula|
|00002f50| 72 20 72 65 67 69 6f 6e | 20 2a 2f 0d 09 09 53 65 |r region| */...Se|
|00002f60| 74 52 65 63 74 52 67 6e | 28 61 72 72 6f 77 52 67 |tRectRgn|(arrowRg|
|00002f70| 6e 2c 20 6b 45 78 74 72 | 65 6d 65 4e 65 67 2c 20 |n, kExtr|emeNeg, |
|00002f80| 6b 45 78 74 72 65 6d 65 | 4e 65 67 2c 20 6b 45 78 |kExtreme|Neg, kEx|
|00002f90| 74 72 65 6d 65 50 6f 73 | 2c 20 6b 45 78 74 72 65 |tremePos|, kExtre|
|00002fa0| 6d 65 50 6f 73 29 3b 0d | 0d 09 09 2f 2a 20 63 61 |mePos);.|.../* ca|
|00002fb0| 6c 63 75 6c 61 74 65 20 | 70 6c 75 73 52 67 6e 20 |lculate |plusRgn |
|00002fc0| 2a 2f 0d 09 09 69 66 20 | 28 20 49 73 41 70 70 57 |*/...if |( IsAppW|
|00002fd0| 69 6e 64 6f 77 28 77 69 | 6e 64 6f 77 29 20 29 20 |indow(wi|ndow) ) |
|00002fe0| 7b 0d 09 09 09 53 65 74 | 50 6f 72 74 28 77 69 6e |{....Set|Port(win|
|00002ff0| 64 6f 77 29 3b 09 2f 2a | 20 6d 61 6b 65 20 61 20 |dow);./*| make a |
|00003000| 67 6c 6f 62 61 6c 20 76 | 65 72 73 69 6f 6e 20 6f |global v|ersion o|
|00003010| 66 20 74 68 65 20 76 69 | 65 77 52 65 63 74 20 2a |f the vi|ewRect *|
|00003020| 2f 0d 09 09 09 53 65 74 | 4f 72 69 67 69 6e 28 2d |/....Set|Origin(-|
|00003030| 77 69 6e 64 6f 77 2d 3e | 70 6f 72 74 42 69 74 73 |window->|portBits|
|00003040| 2e 62 6f 75 6e 64 73 2e | 6c 65 66 74 2c 20 2d 77 |.bounds.|left, -w|
|00003050| 69 6e 64 6f 77 2d 3e 70 | 6f 72 74 42 69 74 73 2e |indow->p|ortBits.|
|00003060| 62 6f 75 6e 64 73 2e 74 | 6f 70 29 3b 0d 09 09 09 |bounds.t|op);....|
|00003070| 67 6c 6f 62 61 6c 50 6f | 72 74 52 65 63 74 20 3d |globalPo|rtRect =|
|00003080| 20 77 69 6e 64 6f 77 2d | 3e 70 6f 72 74 52 65 63 | window-|>portRec|
|00003090| 74 3b 0d 09 09 09 52 65 | 63 74 52 67 6e 28 70 6c |t;....Re|ctRgn(pl|
|000030a0| 75 73 52 67 6e 2c 20 26 | 67 6c 6f 62 61 6c 50 6f |usRgn, &|globalPo|
|000030b0| 72 74 52 65 63 74 29 3b | 0d 09 09 09 53 65 63 74 |rtRect);|....Sect|
|000030c0| 52 67 6e 28 70 6c 75 73 | 52 67 6e 2c 20 77 69 6e |Rgn(plus|Rgn, win|
|000030d0| 64 6f 77 2d 3e 76 69 73 | 52 67 6e 2c 20 70 6c 75 |dow->vis|Rgn, plu|
|000030e0| 73 52 67 6e 29 3b 0d 09 | 09 09 53 65 74 4f 72 69 |sRgn);..|..SetOri|
|000030f0| 67 69 6e 28 30 2c 20 30 | 29 3b 0d 09 09 7d 0d 0d |gin(0, 0|);...}..|
|00003100| 09 09 2f 2a 20 73 75 62 | 74 72 61 63 74 20 6f 74 |../* sub|tract ot|
|00003110| 68 65 72 20 72 65 67 69 | 6f 6e 73 20 66 72 6f 6d |her regi|ons from|
|00003120| 20 61 72 72 6f 77 52 67 | 6e 20 2a 2f 0d 09 09 44 | arrowRg|n */...D|
|00003130| 69 66 66 52 67 6e 28 61 | 72 72 6f 77 52 67 6e 2c |iffRgn(a|rrowRgn,|
|00003140| 20 70 6c 75 73 52 67 6e | 2c 20 61 72 72 6f 77 52 | plusRgn|, arrowR|
|00003150| 67 6e 29 3b 0d 0d 09 09 | 2f 2a 20 63 68 61 6e 67 |gn);....|/* chang|
|00003160| 65 20 74 68 65 20 63 75 | 72 73 6f 72 20 61 6e 64 |e the cu|rsor and|
|00003170| 20 74 68 65 20 72 65 67 | 69 6f 6e 20 70 61 72 61 | the reg|ion para|
|00003180| 6d 65 74 65 72 20 2a 2f | 0d 09 09 69 66 20 28 20 |meter */|...if ( |
|00003190| 50 74 49 6e 52 67 6e 28 | 6d 6f 75 73 65 2c 20 70 |PtInRgn(|mouse, p|
|000031a0| 6c 75 73 52 67 6e 29 20 | 29 20 7b 0d 09 09 09 53 |lusRgn) |) {....S|
|000031b0| 65 74 43 75 72 73 6f 72 | 28 2a 47 65 74 43 75 72 |etCursor|(*GetCur|
|000031c0| 73 6f 72 28 70 6c 75 73 | 43 75 72 73 6f 72 29 29 |sor(plus|Cursor))|
|000031d0| 3b 0d 09 09 09 43 6f 70 | 79 52 67 6e 28 70 6c 75 |;....Cop|yRgn(plu|
|000031e0| 73 52 67 6e 2c 20 72 65 | 67 69 6f 6e 29 3b 0d 09 |sRgn, re|gion);..|
|000031f0| 09 7d 20 65 6c 73 65 20 | 7b 0d 09 09 09 53 65 74 |.} else |{....Set|
|00003200| 43 75 72 73 6f 72 28 26 | 71 64 2e 61 72 72 6f 77 |Cursor(&|qd.arrow|
|00003210| 29 3b 0d 09 09 09 43 6f | 70 79 52 67 6e 28 61 72 |);....Co|pyRgn(ar|
|00003220| 72 6f 77 52 67 6e 2c 20 | 72 65 67 69 6f 6e 29 3b |rowRgn, |region);|
|00003230| 0d 09 09 7d 0d 0d 09 09 | 2f 2a 20 67 65 74 20 72 |...}....|/* get r|
|00003240| 69 64 20 6f 66 20 6f 75 | 72 20 6c 6f 63 61 6c 20 |id of ou|r local |
|00003250| 72 65 67 69 6f 6e 73 20 | 2a 2f 0d 09 09 44 69 73 |regions |*/...Dis|
|00003260| 70 6f 73 65 52 67 6e 28 | 61 72 72 6f 77 52 67 6e |poseRgn(|arrowRgn|
|00003270| 29 3b 0d 09 09 44 69 73 | 70 6f 73 65 52 67 6e 28 |);...Dis|poseRgn(|
|00003280| 70 6c 75 73 52 67 6e 29 | 3b 0d 09 7d 0d 7d 20 2f |plusRgn)|;..}.} /|
|00003290| 2a 41 64 6a 75 73 74 43 | 75 72 73 6f 72 2a 2f 0d |*AdjustC|ursor*/.|
|000032a0| 0d 0d 2f 2a 09 47 65 74 | 20 74 68 65 20 67 6c 6f |../*.Get| the glo|
|000032b0| 62 61 6c 20 63 6f 6f 72 | 64 69 6e 61 74 65 73 20 |bal coor|dinates |
|000032c0| 6f 66 20 74 68 65 20 6d | 6f 75 73 65 2e 20 57 68 |of the m|ouse. Wh|
|000032d0| 65 6e 20 79 6f 75 20 63 | 61 6c 6c 20 4f 53 45 76 |en you c|all OSEv|
|000032e0| 65 6e 74 41 76 61 69 6c | 0d 09 69 74 20 77 69 6c |entAvail|..it wil|
|000032f0| 6c 20 72 65 74 75 72 6e | 20 65 69 74 68 65 72 20 |l return| either |
|00003300| 61 20 70 65 6e 64 69 6e | 67 20 65 76 65 6e 74 20 |a pendin|g event |
|00003310| 6f 72 20 61 20 6e 75 6c | 6c 20 65 76 65 6e 74 2e |or a nul|l event.|
|00003320| 20 49 6e 20 65 69 74 68 | 65 72 20 63 61 73 65 2c | In eith|er case,|
|00003330| 0d 09 74 68 65 20 77 68 | 65 72 65 20 66 69 65 6c |..the wh|ere fiel|
|00003340| 64 20 6f 66 20 74 68 65 | 20 65 76 65 6e 74 20 72 |d of the| event r|
|00003350| 65 63 6f 72 64 20 77 69 | 6c 6c 20 63 6f 6e 74 61 |ecord wi|ll conta|
|00003360| 69 6e 20 74 68 65 20 63 | 75 72 72 65 6e 74 20 70 |in the c|urrent p|
|00003370| 6f 73 69 74 69 6f 6e 0d | 09 6f 66 20 74 68 65 20 |osition.|.of the |
|00003380| 6d 6f 75 73 65 20 69 6e | 20 67 6c 6f 62 61 6c 20 |mouse in| global |
|00003390| 63 6f 6f 72 64 69 6e 61 | 74 65 73 20 61 6e 64 20 |coordina|tes and |
|000033a0| 74 68 65 20 6d 6f 64 69 | 66 69 65 72 73 20 66 69 |the modi|fiers fi|
|000033b0| 65 6c 64 20 77 69 6c 6c | 20 72 65 66 6c 65 63 74 |eld will| reflect|
|000033c0| 0d 09 74 68 65 20 63 75 | 72 72 65 6e 74 20 73 74 |..the cu|rrent st|
|000033d0| 61 74 65 20 6f 66 20 74 | 68 65 20 6d 6f 64 69 66 |ate of t|he modif|
|000033e0| 69 65 72 73 2e 20 41 6e | 6f 74 68 65 72 20 77 61 |iers. An|other wa|
|000033f0| 79 20 74 6f 20 67 65 74 | 20 74 68 65 20 67 6c 6f |y to get| the glo|
|00003400| 62 61 6c 0d 09 63 6f 6f | 72 64 69 6e 61 74 65 73 |bal..coo|rdinates|
|00003410| 20 69 73 20 74 6f 20 63 | 61 6c 6c 20 47 65 74 4d | is to c|all GetM|
|00003420| 6f 75 73 65 20 61 6e 64 | 20 4c 6f 63 61 6c 54 6f |ouse and| LocalTo|
|00003430| 47 6c 6f 62 61 6c 2c 20 | 62 75 74 20 74 68 61 74 |Global, |but that|
|00003440| 20 72 65 71 75 69 72 65 | 73 0d 09 62 65 69 6e 67 | require|s..being|
|00003450| 20 73 75 72 65 20 74 68 | 61 74 20 74 68 65 50 6f | sure th|at thePo|
|00003460| 72 74 20 69 73 20 73 65 | 74 20 74 6f 20 61 20 76 |rt is se|t to a v|
|00003470| 61 6c 69 64 20 70 6f 72 | 74 2e 20 2a 2f 0d 0d 23 |alid por|t. */..#|
|00003480| 70 72 61 67 6d 61 20 73 | 65 67 6d 65 6e 74 20 4d |pragma s|egment M|
|00003490| 61 69 6e 0d 76 6f 69 64 | 20 47 65 74 47 6c 6f 62 |ain.void| GetGlob|
|000034a0| 61 6c 4d 6f 75 73 65 28 | 6d 6f 75 73 65 29 0d 09 |alMouse(|mouse)..|
|000034b0| 50 6f 69 6e 74 09 2a 6d | 6f 75 73 65 3b 0d 7b 0d |Point.*m|ouse;.{.|
|000034c0| 09 45 76 65 6e 74 52 65 | 63 6f 72 64 09 65 76 65 |.EventRe|cord.eve|
|000034d0| 6e 74 3b 0d 09 0d 09 4f | 53 45 76 65 6e 74 41 76 |nt;....O|SEventAv|
|000034e0| 61 69 6c 28 6b 4e 6f 45 | 76 65 6e 74 73 2c 20 26 |ail(kNoE|vents, &|
|000034f0| 65 76 65 6e 74 29 3b 09 | 2f 2a 20 77 65 20 61 72 |event);.|/* we ar|
|00003500| 65 6e 27 74 20 69 6e 74 | 65 72 65 73 74 65 64 20 |en't int|erested |
|00003510| 69 6e 20 61 6e 79 20 65 | 76 65 6e 74 73 20 2a 2f |in any e|vents */|
|00003520| 0d 09 2a 6d 6f 75 73 65 | 20 3d 20 65 76 65 6e 74 |..*mouse| = event|
|00003530| 2e 77 68 65 72 65 3b 09 | 09 09 09 2f 2a 20 6a 75 |.where;.|.../* ju|
|00003540| 73 74 20 74 68 65 20 6d | 6f 75 73 65 20 70 6f 73 |st the m|ouse pos|
|00003550| 69 74 69 6f 6e 20 2a 2f | 0d 7d 20 2f 2a 47 65 74 |ition */|.} /*Get|
|00003560| 47 6c 6f 62 61 6c 4d 6f | 75 73 65 2a 2f 0d 0d 0d |GlobalMo|use*/...|
|00003570| 2f 2a 09 54 68 69 73 20 | 69 73 20 63 61 6c 6c 65 |/*.This |is calle|
|00003580| 64 20 77 68 65 6e 20 61 | 6e 20 75 70 64 61 74 65 |d when a|n update|
|00003590| 20 65 76 65 6e 74 20 69 | 73 20 72 65 63 65 69 76 | event i|s receiv|
|000035a0| 65 64 20 66 6f 72 20 61 | 20 77 69 6e 64 6f 77 2e |ed for a| window.|
|000035b0| 0d 09 49 74 20 63 61 6c | 6c 73 20 44 72 61 77 57 |..It cal|ls DrawW|
|000035c0| 69 6e 64 6f 77 20 74 6f | 20 64 72 61 77 20 74 68 |indow to| draw th|
|000035d0| 65 20 63 6f 6e 74 65 6e | 74 73 20 6f 66 20 61 6e |e conten|ts of an|
|000035e0| 20 61 70 70 6c 69 63 61 | 74 69 6f 6e 20 77 69 6e | applica|tion win|
|000035f0| 64 6f 77 2e 0d 09 41 73 | 20 61 6e 20 65 66 66 65 |dow...As| an effe|
|00003600| 63 69 65 6e 63 79 20 6d | 65 61 73 75 72 65 20 74 |ciency m|easure t|
|00003610| 68 61 74 20 64 6f 65 73 | 20 6e 6f 74 20 68 61 76 |hat does| not hav|
|00003620| 65 20 74 6f 20 62 65 20 | 66 6f 6c 6c 6f 77 65 64 |e to be |followed|
|00003630| 2c 20 69 74 0d 09 63 61 | 6c 6c 73 20 74 68 65 20 |, it..ca|lls the |
|00003640| 64 72 61 77 69 6e 67 20 | 72 6f 75 74 69 6e 65 20 |drawing |routine |
|00003650| 6f 6e 6c 79 20 69 66 20 | 74 68 65 20 76 69 73 52 |only if |the visR|
|00003660| 67 6e 20 69 73 20 6e 6f | 6e 2d 65 6d 70 74 79 2e |gn is no|n-empty.|
|00003670| 20 54 68 69 73 0d 09 77 | 69 6c 6c 20 68 61 6e 64 | This..w|ill hand|
|00003680| 6c 65 20 73 69 74 75 61 | 74 69 6f 6e 73 20 77 68 |le situa|tions wh|
|00003690| 65 72 65 20 63 61 6c 63 | 75 6c 61 74 69 6f 6e 73 |ere calc|ulations|
|000036a0| 20 66 6f 72 20 64 72 61 | 77 69 6e 67 20 6f 72 20 | for dra|wing or |
|000036b0| 64 72 61 77 69 6e 67 0d | 09 69 74 73 65 6c 66 20 |drawing.|.itself |
|000036c0| 69 73 20 76 65 72 79 20 | 74 69 6d 65 2d 63 6f 6e |is very |time-con|
|000036d0| 73 75 6d 69 6e 67 2e 20 | 2a 2f 0d 0d 23 70 72 61 |suming. |*/..#pra|
|000036e0| 67 6d 61 20 73 65 67 6d | 65 6e 74 20 4d 61 69 6e |gma segm|ent Main|
|000036f0| 0d 76 6f 69 64 20 44 6f | 55 70 64 61 74 65 28 77 |.void Do|Update(w|
|00003700| 69 6e 64 6f 77 29 0d 09 | 57 69 6e 64 6f 77 50 74 |indow)..|WindowPt|
|00003710| 72 09 77 69 6e 64 6f 77 | 3b 0d 7b 0d 09 69 66 20 |r.window|;.{..if |
|00003720| 28 20 49 73 41 70 70 57 | 69 6e 64 6f 77 28 77 69 |( IsAppW|indow(wi|
|00003730| 6e 64 6f 77 29 20 29 20 | 7b 0d 09 09 55 70 64 61 |ndow) ) |{...Upda|
|00003740| 74 65 57 69 6e 64 6f 77 | 28 77 69 6e 64 6f 77 29 |teWindow|(window)|
|00003750| 3b 09 09 09 2f 2a 20 3c | 4d 43 3e 20 2a 2f 0d 09 |;.../* <|MC> */..|
|00003760| 7d 0d 7d 20 2f 2a 44 6f | 55 70 64 61 74 65 2a 2f |}.} /*Do|Update*/|
|00003770| 0d 0d 0d 2f 2a 09 54 68 | 69 73 20 69 73 20 63 61 |.../*.Th|is is ca|
|00003780| 6c 6c 65 64 20 77 68 65 | 6e 20 61 20 77 69 6e 64 |lled whe|n a wind|
|00003790| 6f 77 20 69 73 20 61 63 | 74 69 76 61 74 65 64 20 |ow is ac|tivated |
|000037a0| 6f 72 20 64 65 61 63 74 | 69 76 61 74 65 64 2e 0d |or deact|ivated..|
|000037b0| 09 49 6e 20 53 61 6d 70 | 6c 65 2c 20 74 68 65 20 |.In Samp|le, the |
|000037c0| 57 69 6e 64 6f 77 20 4d | 61 6e 61 67 65 72 27 73 |Window M|anager's|
|000037d0| 20 68 61 6e 64 6c 69 6e | 67 20 6f 66 20 61 63 74 | handlin|g of act|
|000037e0| 69 76 61 74 65 20 61 6e | 64 0d 09 64 65 61 63 74 |ivate an|d..deact|
|000037f0| 69 76 61 74 65 20 65 76 | 65 6e 74 73 20 69 73 20 |ivate ev|ents is |
|00003800| 73 75 66 66 69 63 69 65 | 6e 74 2e 20 4f 74 68 65 |sufficie|nt. Othe|
|00003810| 72 20 61 70 70 6c 69 63 | 61 74 69 6f 6e 73 20 6d |r applic|ations m|
|00003820| 61 79 20 68 61 76 65 0d | 09 54 65 78 74 45 64 69 |ay have.|.TextEdi|
|00003830| 74 20 72 65 63 6f 72 64 | 73 2c 20 63 6f 6e 74 72 |t record|s, contr|
|00003840| 6f 6c 73 2c 20 6c 69 73 | 74 73 2c 20 65 74 63 2e |ols, lis|ts, etc.|
|00003850| 2c 20 74 6f 20 61 63 74 | 69 76 61 74 65 2f 64 65 |, to act|ivate/de|
|00003860| 61 63 74 69 76 61 74 65 | 2e 20 2a 2f 0d 0d 23 70 |activate|. */..#p|
|00003870| 72 61 67 6d 61 20 73 65 | 67 6d 65 6e 74 20 4d 61 |ragma se|gment Ma|
|00003880| 69 6e 0d 76 6f 69 64 20 | 44 6f 41 63 74 69 76 61 |in.void |DoActiva|
|00003890| 74 65 20 28 57 69 6e 64 | 6f 77 50 74 72 20 77 69 |te (Wind|owPtr wi|
|000038a0| 6e 64 6f 77 2c 20 42 6f | 6f 6c 65 61 6e 20 62 65 |ndow, Bo|olean be|
|000038b0| 63 6f 6d 69 6e 67 41 63 | 74 69 76 65 29 0d 7b 0d |comingAc|tive).{.|
|000038c0| 09 69 66 20 28 20 49 73 | 41 70 70 57 69 6e 64 6f |.if ( Is|AppWindo|
|000038d0| 77 28 77 69 6e 64 6f 77 | 29 20 29 20 7b 0d 09 09 |w(window|) ) {...|
|000038e0| 69 66 20 28 20 62 65 63 | 6f 6d 69 6e 67 41 63 74 |if ( bec|omingAct|
|000038f0| 69 76 65 20 29 0d 09 09 | 09 2f 2a 20 64 6f 20 77 |ive )...|./* do w|
|00003900| 68 61 74 65 76 65 72 20 | 79 6f 75 20 6e 65 65 64 |hatever |you need|
|00003910| 20 74 6f 20 61 74 20 61 | 63 74 69 76 61 74 69 6f | to at a|ctivatio|
|00003920| 6e 20 2a 2f 20 3b 0d 09 | 09 65 6c 73 65 0d 09 09 |n */ ;..|.else...|
|00003930| 09 2f 2a 20 64 6f 20 77 | 68 61 74 65 76 65 72 20 |./* do w|hatever |
|00003940| 79 6f 75 20 6e 65 65 64 | 20 74 6f 20 61 74 20 64 |you need| to at d|
|00003950| 65 61 63 74 69 76 61 74 | 69 6f 6e 20 2a 2f 20 3b |eactivat|ion */ ;|
|00003960| 0d 09 7d 0d 7d 20 2f 2a | 44 6f 41 63 74 69 76 61 |..}.} /*|DoActiva|
|00003970| 74 65 2a 2f 0d 0d 0d 0d | 2f 2a 09 45 6e 61 62 6c |te*/....|/*.Enabl|
|00003980| 65 20 61 6e 64 20 64 69 | 73 61 62 6c 65 20 6d 65 |e and di|sable me|
|00003990| 6e 75 73 20 62 61 73 65 | 64 20 6f 6e 20 74 68 65 |nus base|d on the|
|000039a0| 20 63 75 72 72 65 6e 74 | 20 73 74 61 74 65 2e 0d | current| state..|
|000039b0| 09 54 68 65 20 75 73 65 | 72 20 63 61 6e 20 6f 6e |.The use|r can on|
|000039c0| 6c 79 20 73 65 6c 65 63 | 74 20 65 6e 61 62 6c 65 |ly selec|t enable|
|000039d0| 64 20 6d 65 6e 75 20 69 | 74 65 6d 73 2e 20 57 65 |d menu i|tems. We|
|000039e0| 20 73 65 74 20 75 70 20 | 61 6c 6c 20 74 68 65 20 | set up |all the |
|000039f0| 6d 65 6e 75 20 69 74 65 | 6d 73 0d 09 62 65 66 6f |menu ite|ms..befo|
|00003a00| 72 65 20 63 61 6c 6c 69 | 6e 67 20 4d 65 6e 75 53 |re calli|ng MenuS|
|00003a10| 65 6c 65 63 74 20 6f 72 | 20 4d 65 6e 75 4b 65 79 |elect or| MenuKey|
|00003a20| 2c 20 73 69 6e 63 65 20 | 74 68 65 73 65 20 61 72 |, since |these ar|
|00003a30| 65 20 74 68 65 20 6f 6e | 6c 79 20 74 69 6d 65 73 |e the on|ly times|
|00003a40| 20 74 68 61 74 0d 09 61 | 20 6d 65 6e 75 20 69 74 | that..a| menu it|
|00003a50| 65 6d 20 63 61 6e 20 62 | 65 20 73 65 6c 65 63 74 |em can b|e select|
|00003a60| 65 64 2e 20 4e 6f 74 65 | 20 74 68 61 74 20 4d 65 |ed. Note| that Me|
|00003a70| 6e 75 53 65 6c 65 63 74 | 20 69 73 20 61 6c 73 6f |nuSelect| is also|
|00003a80| 20 74 68 65 20 6f 6e 6c | 79 20 74 69 6d 65 0d 09 | the onl|y time..|
|00003a90| 74 68 65 20 75 73 65 72 | 20 77 69 6c 6c 20 73 65 |the user| will se|
|00003aa0| 65 20 6d 65 6e 75 20 69 | 74 65 6d 73 2e 20 54 68 |e menu i|tems. Th|
|00003ab0| 69 73 20 61 70 70 72 6f | 61 63 68 20 74 6f 20 64 |is appro|ach to d|
|00003ac0| 65 63 69 64 69 6e 67 20 | 77 68 61 74 20 65 6e 61 |eciding |what ena|
|00003ad0| 62 6c 65 2f 0d 09 64 69 | 73 61 62 6c 65 20 73 74 |ble/..di|sable st|
|00003ae0| 61 74 65 20 61 20 6d 65 | 6e 75 20 69 74 65 6d 20 |ate a me|nu item |
|00003af0| 68 61 73 20 74 68 65 20 | 61 64 76 61 6e 74 61 67 |has the |advantag|
|00003b00| 65 20 6f 66 20 63 6f 6e | 63 65 6e 74 72 61 74 69 |e of con|centrati|
|00003b10| 6e 67 20 61 6c 6c 0d 09 | 74 68 65 20 64 65 63 69 |ng all..|the deci|
|00003b20| 73 69 6f 6e 2d 6d 61 6b | 69 6e 67 20 69 6e 20 6f |sion-mak|ing in o|
|00003b30| 6e 65 20 72 6f 75 74 69 | 6e 65 2c 20 61 73 20 6f |ne routi|ne, as o|
|00003b40| 70 70 6f 73 65 64 20 74 | 6f 20 62 65 69 6e 67 20 |pposed t|o being |
|00003b50| 73 70 72 65 61 64 20 74 | 68 72 6f 75 67 68 6f 75 |spread t|hroughou|
|00003b60| 74 0d 09 74 68 65 20 61 | 70 70 6c 69 63 61 74 69 |t..the a|pplicati|
|00003b70| 6f 6e 2e 20 4f 74 68 65 | 72 20 61 70 70 6c 69 63 |on. Othe|r applic|
|00003b80| 61 74 69 6f 6e 20 64 65 | 73 69 67 6e 73 20 6d 61 |ation de|signs ma|
|00003b90| 79 20 74 61 6b 65 20 61 | 20 64 69 66 66 65 72 65 |y take a| differe|
|00003ba0| 6e 74 20 61 70 70 72 6f | 61 63 68 0d 09 74 68 61 |nt appro|ach..tha|
|00003bb0| 74 20 69 73 20 6a 75 73 | 74 20 61 73 20 76 61 6c |t is jus|t as val|
|00003bc0| 69 64 2e 20 2a 2f 0d 0d | 23 70 72 61 67 6d 61 20 |id. */..|#pragma |
|00003bd0| 73 65 67 6d 65 6e 74 20 | 4d 61 69 6e 0d 76 6f 69 |segment |Main.voi|
|00003be0| 64 20 41 64 6a 75 73 74 | 4d 65 6e 75 73 28 29 0d |d Adjust|Menus().|
|00003bf0| 7b 0d 09 57 69 6e 64 6f | 77 50 74 72 09 77 69 6e |{..Windo|wPtr.win|
|00003c00| 64 6f 77 3b 0d 09 4d 65 | 6e 75 48 61 6e 64 6c 65 |dow;..Me|nuHandle|
|00003c10| 09 6d 65 6e 75 3b 0d 0d | 09 77 69 6e 64 6f 77 20 |.menu;..|.window |
|00003c20| 3d 20 46 72 6f 6e 74 57 | 69 6e 64 6f 77 28 29 3b |= FrontW|indow();|
|00003c30| 0d 0d 09 6d 65 6e 75 20 | 3d 20 47 65 74 4d 48 61 |...menu |= GetMHa|
|00003c40| 6e 64 6c 65 28 6d 46 69 | 6c 65 29 3b 0d 09 69 66 |ndle(mFi|le);..if|
|00003c50| 20 28 20 49 73 44 41 57 | 69 6e 64 6f 77 28 77 69 | ( IsDAW|indow(wi|
|00003c60| 6e 64 6f 77 29 20 29 09 | 09 2f 2a 20 77 65 20 63 |ndow) ).|./* we c|
|00003c70| 61 6e 20 61 6c 6c 6f 77 | 20 64 65 73 6b 20 61 63 |an allow| desk ac|
|00003c80| 63 65 73 73 6f 72 69 65 | 73 20 74 6f 20 62 65 20 |cessorie|s to be |
|00003c90| 63 6c 6f 73 65 64 20 66 | 72 6f 6d 20 74 68 65 20 |closed f|rom the |
|00003ca0| 6d 65 6e 75 20 2a 2f 0d | 09 09 45 6e 61 62 6c 65 |menu */.|..Enable|
|00003cb0| 49 74 65 6d 28 6d 65 6e | 75 2c 20 69 43 6c 6f 73 |Item(men|u, iClos|
|00003cc0| 65 29 3b 0d 09 65 6c 73 | 65 0d 09 09 44 69 73 61 |e);..els|e...Disa|
|00003cd0| 62 6c 65 49 74 65 6d 28 | 6d 65 6e 75 2c 20 69 43 |bleItem(|menu, iC|
|00003ce0| 6c 6f 73 65 29 3b 09 2f | 2a 20 62 75 74 20 6e 6f |lose);./|* but no|
|00003cf0| 74 20 6f 75 72 20 74 72 | 61 66 66 69 63 20 6c 69 |t our tr|affic li|
|00003d00| 67 68 74 20 77 69 6e 64 | 6f 77 20 2a 2f 0d 0d 09 |ght wind|ow */...|
|00003d10| 6d 65 6e 75 20 3d 20 47 | 65 74 4d 48 61 6e 64 6c |menu = G|etMHandl|
|00003d20| 65 28 6d 45 64 69 74 29 | 3b 0d 09 69 66 20 28 20 |e(mEdit)|;..if ( |
|00003d30| 49 73 44 41 57 69 6e 64 | 6f 77 28 77 69 6e 64 6f |IsDAWind|ow(windo|
|00003d40| 77 29 20 29 20 7b 09 09 | 2f 2a 20 61 20 64 65 73 |w) ) {..|/* a des|
|00003d50| 6b 20 61 63 63 65 73 73 | 6f 72 79 20 6d 69 67 68 |k access|ory migh|
|00003d60| 74 20 6e 65 65 64 20 74 | 68 65 20 65 64 69 74 20 |t need t|he edit |
|00003d70| 6d 65 6e 75 c9 20 2a 2f | 0d 09 09 45 6e 61 62 6c |menu. */|...Enabl|
|00003d80| 65 49 74 65 6d 28 6d 65 | 6e 75 2c 20 69 55 6e 64 |eItem(me|nu, iUnd|
|00003d90| 6f 29 3b 0d 09 09 45 6e | 61 62 6c 65 49 74 65 6d |o);...En|ableItem|
|00003da0| 28 6d 65 6e 75 2c 20 69 | 43 75 74 29 3b 0d 09 09 |(menu, i|Cut);...|
|00003db0| 45 6e 61 62 6c 65 49 74 | 65 6d 28 6d 65 6e 75 2c |EnableIt|em(menu,|
|00003dc0| 20 69 43 6f 70 79 29 3b | 0d 09 09 45 6e 61 62 6c | iCopy);|...Enabl|
|00003dd0| 65 49 74 65 6d 28 6d 65 | 6e 75 2c 20 69 43 6c 65 |eItem(me|nu, iCle|
|00003de0| 61 72 29 3b 0d 09 09 45 | 6e 61 62 6c 65 49 74 65 |ar);...E|nableIte|
|00003df0| 6d 28 6d 65 6e 75 2c 20 | 69 50 61 73 74 65 29 3b |m(menu, |iPaste);|
|00003e00| 0d 09 7d 20 65 6c 73 65 | 20 7b 09 09 09 09 09 09 |..} else| {......|
|00003e10| 2f 2a 20 c9 62 75 74 20 | 77 65 20 64 6f 6e d5 74 |/* .but |we don.t|
|00003e20| 20 75 73 65 20 69 74 20 | 2a 2f 0d 09 09 44 69 73 | use it |*/...Dis|
|00003e30| 61 62 6c 65 49 74 65 6d | 28 6d 65 6e 75 2c 20 69 |ableItem|(menu, i|
|00003e40| 55 6e 64 6f 29 3b 0d 09 | 09 44 69 73 61 62 6c 65 |Undo);..|.Disable|
|00003e50| 49 74 65 6d 28 6d 65 6e | 75 2c 20 69 43 75 74 29 |Item(men|u, iCut)|
|00003e60| 3b 0d 09 09 44 69 73 61 | 62 6c 65 49 74 65 6d 28 |;...Disa|bleItem(|
|00003e70| 6d 65 6e 75 2c 20 69 43 | 6f 70 79 29 3b 0d 09 09 |menu, iC|opy);...|
|00003e80| 44 69 73 61 62 6c 65 49 | 74 65 6d 28 6d 65 6e 75 |DisableI|tem(menu|
|00003e90| 2c 20 69 43 6c 65 61 72 | 29 3b 0d 09 09 44 69 73 |, iClear|);...Dis|
|00003ea0| 61 62 6c 65 49 74 65 6d | 28 6d 65 6e 75 2c 20 69 |ableItem|(menu, i|
|00003eb0| 50 61 73 74 65 29 3b 0d | 09 7d 0d 0d 09 41 64 6a |Paste);.|.}...Adj|
|00003ec0| 75 73 74 41 64 64 69 74 | 69 6f 6e 61 6c 4d 65 6e |ustAddit|ionalMen|
|00003ed0| 75 73 20 28 29 3b 09 09 | 2f 2a 20 6e 65 77 20 3c |us ();..|/* new <|
|00003ee0| 4d 43 3e 20 2a 2f 0d 09 | 0d 7d 20 2f 2a 41 64 6a |MC> */..|.} /*Adj|
|00003ef0| 75 73 74 4d 65 6e 75 73 | 2a 2f 0d 0d 0d 2f 2a 09 |ustMenus|*/.../*.|
|00003f00| 54 68 69 73 20 69 73 20 | 63 61 6c 6c 65 64 20 77 |This is |called w|
|00003f10| 68 65 6e 20 61 6e 20 69 | 74 65 6d 20 69 73 20 63 |hen an i|tem is c|
|00003f20| 68 6f 73 65 6e 20 66 72 | 6f 6d 20 74 68 65 20 6d |hosen fr|om the m|
|00003f30| 65 6e 75 20 62 61 72 20 | 28 61 66 74 65 72 20 63 |enu bar |(after c|
|00003f40| 61 6c 6c 69 6e 67 0d 09 | 4d 65 6e 75 53 65 6c 65 |alling..|MenuSele|
|00003f50| 63 74 20 6f 72 20 4d 65 | 6e 75 4b 65 79 29 2e 20 |ct or Me|nuKey). |
|00003f60| 49 74 20 70 65 72 66 6f | 72 6d 73 20 74 68 65 20 |It perfo|rms the |
|00003f70| 72 69 67 68 74 20 6f 70 | 65 72 61 74 69 6f 6e 20 |right op|eration |
|00003f80| 66 6f 72 20 65 61 63 68 | 20 63 6f 6d 6d 61 6e 64 |for each| command|
|00003f90| 2e 0d 09 49 74 20 69 73 | 20 67 6f 6f 64 20 74 6f |...It is| good to|
|00003fa0| 20 68 61 76 65 20 62 6f | 74 68 20 74 68 65 20 72 | have bo|th the r|
|00003fb0| 65 73 75 6c 74 20 6f 66 | 20 4d 65 6e 75 53 65 6c |esult of| MenuSel|
|00003fc0| 65 63 74 20 61 6e 64 20 | 4d 65 6e 75 4b 65 79 20 |ect and |MenuKey |
|00003fd0| 67 6f 20 74 6f 0d 09 6f | 6e 65 20 72 6f 75 74 69 |go to..o|ne routi|
|00003fe0| 6e 65 20 6c 69 6b 65 20 | 74 68 69 73 20 74 6f 20 |ne like |this to |
|00003ff0| 6b 65 65 70 20 65 76 65 | 72 79 74 68 69 6e 67 20 |keep eve|rything |
|00004000| 6f 72 67 61 6e 69 7a 65 | 64 2e 20 2a 2f 0d 0d 23 |organize|d. */..#|
|00004010| 70 72 61 67 6d 61 20 73 | 65 67 6d 65 6e 74 20 4d |pragma s|egment M|
|00004020| 61 69 6e 0d 76 6f 69 64 | 20 44 6f 4d 65 6e 75 43 |ain.void| DoMenuC|
|00004030| 6f 6d 6d 61 6e 64 28 6d | 65 6e 75 52 65 73 75 6c |ommand(m|enuResul|
|00004040| 74 29 0d 09 6c 6f 6e 67 | 09 09 6d 65 6e 75 52 65 |t)..long|..menuRe|
|00004050| 73 75 6c 74 3b 0d 7b 0d | 09 73 68 6f 72 74 09 09 |sult;.{.|.short..|
|00004060| 6d 65 6e 75 49 44 3b 09 | 09 09 09 2f 2a 20 74 68 |menuID;.|.../* th|
|00004070| 65 20 72 65 73 6f 75 72 | 63 65 20 49 44 20 6f 66 |e resour|ce ID of|
|00004080| 20 74 68 65 20 73 65 6c | 65 63 74 65 64 20 6d 65 | the sel|ected me|
|00004090| 6e 75 20 2a 2f 0d 09 73 | 68 6f 72 74 09 09 6d 65 |nu */..s|hort..me|
|000040a0| 6e 75 49 74 65 6d 3b 09 | 09 09 2f 2a 20 74 68 65 |nuItem;.|../* the|
|000040b0| 20 69 74 65 6d 20 6e 75 | 6d 62 65 72 20 6f 66 20 | item nu|mber of |
|000040c0| 74 68 65 20 73 65 6c 65 | 63 74 65 64 20 6d 65 6e |the sele|cted men|
|000040d0| 75 20 2a 2f 0d 09 73 68 | 6f 72 74 09 09 69 74 65 |u */..sh|ort..ite|
|000040e0| 6d 48 69 74 3b 0d 09 53 | 74 72 32 35 35 09 09 64 |mHit;..S|tr255..d|
|000040f0| 61 4e 61 6d 65 3b 0d 09 | 73 68 6f 72 74 09 09 64 |aName;..|short..d|
|00004100| 61 52 65 66 4e 75 6d 3b | 0d 09 42 6f 6f 6c 65 61 |aRefNum;|..Boolea|
|00004110| 6e 09 09 68 61 6e 64 6c | 65 64 42 79 44 41 3b 0d |n..handl|edByDA;.|
|00004120| 0d 09 6d 65 6e 75 49 44 | 20 3d 20 48 69 57 6f 72 |..menuID| = HiWor|
|00004130| 64 28 6d 65 6e 75 52 65 | 73 75 6c 74 29 3b 09 2f |d(menuRe|sult);./|
|00004140| 2a 20 75 73 65 20 6d 61 | 63 72 6f 73 20 66 6f 72 |* use ma|cros for|
|00004150| 20 65 66 66 69 63 69 65 | 6e 63 79 20 74 6f 2e 2e | efficie|ncy to..|
|00004160| 2e 20 2a 2f 0d 09 6d 65 | 6e 75 49 74 65 6d 20 3d |. */..me|nuItem =|
|00004170| 20 4c 6f 57 6f 72 64 28 | 6d 65 6e 75 52 65 73 75 | LoWord(|menuResu|
|00004180| 6c 74 29 3b 09 2f 2a 20 | 67 65 74 20 6d 65 6e 75 |lt);./* |get menu|
|00004190| 20 69 74 65 6d 20 6e 75 | 6d 62 65 72 20 61 6e 64 | item nu|mber and|
|000041a0| 20 6d 65 6e 75 20 6e 75 | 6d 62 65 72 20 2a 2f 0d | menu nu|mber */.|
|000041b0| 09 73 77 69 74 63 68 20 | 28 20 6d 65 6e 75 49 44 |.switch |( menuID|
|000041c0| 20 29 20 7b 0d 09 09 63 | 61 73 65 20 6d 41 70 70 | ) {...c|ase mApp|
|000041d0| 6c 65 3a 0d 09 09 09 73 | 77 69 74 63 68 20 28 20 |le:....s|witch ( |
|000041e0| 6d 65 6e 75 49 74 65 6d | 20 29 20 7b 0d 09 09 09 |menuItem| ) {....|
|000041f0| 09 63 61 73 65 20 69 41 | 62 6f 75 74 3a 09 09 2f |.case iA|bout:../|
|00004200| 2a 20 62 72 69 6e 67 20 | 75 70 20 61 6c 65 72 74 |* bring |up alert|
|00004210| 20 66 6f 72 20 41 62 6f | 75 74 20 2a 2f 0d 09 09 | for Abo|ut */...|
|00004220| 09 09 09 69 74 65 6d 48 | 69 74 20 3d 20 41 6c 65 |...itemH|it = Ale|
|00004230| 72 74 28 72 41 62 6f 75 | 74 41 6c 65 72 74 2c 20 |rt(rAbou|tAlert, |
|00004240| 6e 69 6c 29 3b 0d 09 09 | 09 09 09 62 72 65 61 6b |nil);...|...break|
|00004250| 3b 0d 09 09 09 09 64 65 | 66 61 75 6c 74 3a 09 09 |;.....de|fault:..|
|00004260| 09 2f 2a 20 61 6c 6c 20 | 6e 6f 6e 2d 41 62 6f 75 |./* all |non-Abou|
|00004270| 74 20 69 74 65 6d 73 20 | 69 6e 20 74 68 69 73 20 |t items |in this |
|00004280| 6d 65 6e 75 20 61 72 65 | 20 44 41 73 20 2a 2f 0d |menu are| DAs */.|
|00004290| 09 09 09 09 09 2f 2a 20 | 74 79 70 65 20 53 74 72 |...../* |type Str|
|000042a0| 32 35 35 20 69 73 20 61 | 6e 20 61 72 72 61 79 20 |255 is a|n array |
|000042b0| 69 6e 20 4d 50 57 20 33 | 20 2a 2f 0d 09 09 09 09 |in MPW 3| */.....|
|000042c0| 09 47 65 74 49 74 65 6d | 28 47 65 74 4d 48 61 6e |.GetItem|(GetMHan|
|000042d0| 64 6c 65 28 6d 41 70 70 | 6c 65 29 2c 20 6d 65 6e |dle(mApp|le), men|
|000042e0| 75 49 74 65 6d 2c 20 64 | 61 4e 61 6d 65 29 3b 0d |uItem, d|aName);.|
|000042f0| 09 09 09 09 09 64 61 52 | 65 66 4e 75 6d 20 3d 20 |.....daR|efNum = |
|00004300| 4f 70 65 6e 44 65 73 6b | 41 63 63 28 64 61 4e 61 |OpenDesk|Acc(daNa|
|00004310| 6d 65 29 3b 0d 09 09 09 | 09 09 62 72 65 61 6b 3b |me);....|..break;|
|00004320| 0d 09 09 09 7d 0d 09 09 | 09 62 72 65 61 6b 3b 0d |....}...|.break;.|
|00004330| 09 09 63 61 73 65 20 6d | 46 69 6c 65 3a 0d 09 09 |..case m|File:...|
|00004340| 09 73 77 69 74 63 68 20 | 28 20 6d 65 6e 75 49 74 |.switch |( menuIt|
|00004350| 65 6d 20 29 20 7b 0d 09 | 09 09 09 63 61 73 65 20 |em ) {..|...case |
|00004360| 69 43 6c 6f 73 65 3a 0d | 09 09 09 09 09 44 6f 43 |iClose:.|.....DoC|
|00004370| 6c 6f 73 65 57 69 6e 64 | 6f 77 28 46 72 6f 6e 74 |loseWind|ow(Front|
|00004380| 57 69 6e 64 6f 77 28 29 | 29 3b 0d 09 09 09 09 09 |Window()|);......|
|00004390| 62 72 65 61 6b 3b 0d 09 | 09 09 09 63 61 73 65 20 |break;..|...case |
|000043a0| 69 51 75 69 74 3a 0d 09 | 09 09 09 09 54 65 72 6d |iQuit:..|....Term|
|000043b0| 69 6e 61 74 65 28 29 3b | 0d 09 09 09 09 09 62 72 |inate();|......br|
|000043c0| 65 61 6b 3b 0d 09 09 09 | 7d 0d 09 09 09 62 72 65 |eak;....|}....bre|
|000043d0| 61 6b 3b 0d 09 09 63 61 | 73 65 20 6d 45 64 69 74 |ak;...ca|se mEdit|
|000043e0| 3a 09 09 09 09 09 2f 2a | 20 63 61 6c 6c 20 53 79 |:...../*| call Sy|
|000043f0| 73 74 65 6d 45 64 69 74 | 20 66 6f 72 20 44 41 20 |stemEdit| for DA |
|00004400| 65 64 69 74 69 6e 67 20 | 26 20 4d 75 6c 74 69 46 |editing |& MultiF|
|00004410| 69 6e 64 65 72 20 2a 2f | 0d 09 09 09 68 61 6e 64 |inder */|....hand|
|00004420| 6c 65 64 42 79 44 41 20 | 3d 20 53 79 73 74 65 6d |ledByDA |= System|
|00004430| 45 64 69 74 28 6d 65 6e | 75 49 74 65 6d 2d 31 29 |Edit(men|uItem-1)|
|00004440| 3b 09 2f 2a 20 73 69 6e | 63 65 20 77 65 20 64 6f |;./* sin|ce we do|
|00004450| 6e d5 74 20 64 6f 20 61 | 6e 79 20 45 64 69 74 69 |n.t do a|ny Editi|
|00004460| 6e 67 20 2a 2f 0d 09 09 | 09 62 72 65 61 6b 3b 0d |ng */...|.break;.|
|00004470| 09 7d 0d 09 0d 09 44 6f | 41 64 64 69 74 69 6f 6e |.}....Do|Addition|
|00004480| 61 6c 4d 65 6e 75 43 6f | 6d 6d 61 6e 64 20 28 6d |alMenuCo|mmand (m|
|00004490| 65 6e 75 52 65 73 75 6c | 74 29 3b 09 2f 2a 20 4e |enuResul|t);./* N|
|000044a0| 65 77 20 3c 4d 43 3e 20 | 2a 2f 0d 0d 09 48 69 6c |ew <MC> |*/...Hil|
|000044b0| 69 74 65 4d 65 6e 75 28 | 30 29 3b 09 09 09 09 09 |iteMenu(|0);.....|
|000044c0| 2f 2a 20 75 6e 68 69 67 | 68 6c 69 67 68 74 20 77 |/* unhig|hlight w|
|000044d0| 68 61 74 20 4d 65 6e 75 | 53 65 6c 65 63 74 20 28 |hat Menu|Select (|
|000044e0| 6f 72 20 4d 65 6e 75 4b | 65 79 29 20 68 69 6c 69 |or MenuK|ey) hili|
|000044f0| 74 65 64 20 2a 2f 0d 7d | 20 2f 2a 44 6f 4d 65 6e |ted */.}| /*DoMen|
|00004500| 75 43 6f 6d 6d 61 6e 64 | 2a 2f 0d 0d 0d 0d 2f 2a |uCommand|*/..../*|
|00004510| 20 43 6c 6f 73 65 20 61 | 20 77 69 6e 64 6f 77 2e | Close a| window.|
|00004520| 20 54 68 69 73 20 68 61 | 6e 64 6c 65 73 20 64 65 | This ha|ndles de|
|00004530| 73 6b 20 61 63 63 65 73 | 73 6f 72 79 20 61 6e 64 |sk acces|sory and|
|00004540| 20 61 70 70 6c 69 63 61 | 74 69 6f 6e 20 77 69 6e | applica|tion win|
|00004550| 64 6f 77 73 2e 20 2a 2f | 0d 0d 2f 2a 09 31 2e 30 |dows. */|../*.1.0|
|00004560| 31 20 2d 20 41 74 20 74 | 68 69 73 20 70 6f 69 6e |1 - At t|his poin|
|00004570| 74 2c 20 69 66 20 74 68 | 65 72 65 20 77 61 73 20 |t, if th|ere was |
|00004580| 61 20 64 6f 63 75 6d 65 | 6e 74 20 61 73 73 6f 63 |a docume|nt assoc|
|00004590| 69 61 74 65 64 20 77 69 | 74 68 20 61 0d 09 77 69 |iated wi|th a..wi|
|000045a0| 6e 64 6f 77 2c 20 79 6f | 75 20 63 6f 75 6c 64 20 |ndow, yo|u could |
|000045b0| 64 6f 20 61 6e 79 20 64 | 6f 63 75 6d 65 6e 74 20 |do any d|ocument |
|000045c0| 73 61 76 69 6e 67 20 70 | 72 6f 63 65 73 73 69 6e |saving p|rocessin|
|000045d0| 67 20 69 66 20 69 74 20 | 69 73 20 27 64 69 72 74 |g if it |is 'dirt|
|000045e0| 79 27 2e 0d 09 44 6f 43 | 6c 6f 73 65 57 69 6e 64 |y'...DoC|loseWind|
|000045f0| 6f 77 20 77 6f 75 6c 64 | 20 72 65 74 75 72 6e 20 |ow would| return |
|00004600| 74 72 75 65 20 69 66 20 | 74 68 65 20 77 69 6e 64 |true if |the wind|
|00004610| 6f 77 20 61 63 74 75 61 | 6c 6c 79 20 63 6c 6f 73 |ow actua|lly clos|
|00004620| 65 64 2c 20 69 2e 65 2e | 2c 0d 09 74 68 65 20 75 |ed, i.e.|,..the u|
|00004630| 73 65 72 20 64 69 64 6e | d5 74 20 63 61 6e 63 65 |ser didn|.t cance|
|00004640| 6c 20 66 72 6f 6d 20 61 | 20 73 61 76 65 20 64 69 |l from a| save di|
|00004650| 61 6c 6f 67 2e 20 54 68 | 69 73 20 72 65 73 75 6c |alog. Th|is resul|
|00004660| 74 20 69 73 20 68 61 6e | 64 79 20 77 68 65 6e 0d |t is han|dy when.|
|00004670| 09 74 68 65 20 75 73 65 | 72 20 71 75 69 74 73 20 |.the use|r quits |
|00004680| 61 6e 20 61 70 70 6c 69 | 63 61 74 69 6f 6e 2c 20 |an appli|cation, |
|00004690| 62 75 74 20 74 68 65 6e | 20 63 61 6e 63 65 6c 73 |but then| cancels|
|000046a0| 20 74 68 65 20 73 61 76 | 65 20 6f 66 20 61 20 64 | the sav|e of a d|
|000046b0| 6f 63 75 6d 65 6e 74 0d | 09 61 73 73 6f 63 69 61 |ocument.|.associa|
|000046c0| 74 65 64 20 77 69 74 68 | 20 61 20 77 69 6e 64 6f |ted with| a windo|
|000046d0| 77 2e 20 2a 2f 0d 0d 23 | 70 72 61 67 6d 61 20 73 |w. */..#|pragma s|
|000046e0| 65 67 6d 65 6e 74 20 4d | 61 69 6e 0d 42 6f 6f 6c |egment M|ain.Bool|
|000046f0| 65 61 6e 20 44 6f 43 6c | 6f 73 65 57 69 6e 64 6f |ean DoCl|oseWindo|
|00004700| 77 28 77 69 6e 64 6f 77 | 29 0d 09 57 69 6e 64 6f |w(window|)..Windo|
|00004710| 77 50 74 72 09 77 69 6e | 64 6f 77 3b 0d 7b 0d 09 |wPtr.win|dow;.{..|
|00004720| 69 66 20 28 20 49 73 44 | 41 57 69 6e 64 6f 77 28 |if ( IsD|AWindow(|
|00004730| 77 69 6e 64 6f 77 29 20 | 29 0d 09 09 43 6c 6f 73 |window) |)...Clos|
|00004740| 65 44 65 73 6b 41 63 63 | 28 28 28 57 69 6e 64 6f |eDeskAcc|(((Windo|
|00004750| 77 50 65 65 6b 29 20 77 | 69 6e 64 6f 77 29 2d 3e |wPeek) w|indow)->|
|00004760| 77 69 6e 64 6f 77 4b 69 | 6e 64 29 3b 0d 09 65 6c |windowKi|nd);..el|
|00004770| 73 65 20 69 66 20 28 20 | 49 73 41 70 70 57 69 6e |se if ( |IsAppWin|
|00004780| 64 6f 77 28 77 69 6e 64 | 6f 77 29 20 29 0d 09 09 |dow(wind|ow) )...|
|00004790| 43 6c 6f 73 65 57 69 6e | 64 6f 77 28 77 69 6e 64 |CloseWin|dow(wind|
|000047a0| 6f 77 29 3b 0d 09 72 65 | 74 75 72 6e 20 74 72 75 |ow);..re|turn tru|
|000047b0| 65 3b 0d 7d 20 2f 2a 44 | 6f 43 6c 6f 73 65 57 69 |e;.} /*D|oCloseWi|
|000047c0| 6e 64 6f 77 2a 2f 0d 0d | 0d 2f 2a 2a 2a 2a 2a 2a |ndow*/..|./******|
|000047d0| 2a 2a 2a 2a 2a 2a 2a 2a | 2a 2a 2a 2a 2a 2a 2a 2a |********|********|
|000047e0| 2a 2a 2a 2a 2a 2a 2a 2a | 2a 2a 2a 2a 2a 2a 2a 2a |********|********|
|000047f0| 2a 2a 2a 2a 2a 2a 2a 2a | 2a 2a 2a 2a 2a 2a 2a 2a |********|********|
|00004800| 2a 2a 2a 2a 2a 2a 2a 2a | 2a 2a 2a 2a 2a 2a 2a 2a |********|********|
|00004810| 2a 2a 2a 2a 2a 2a 2a 2a | 2a 2a 2a 2a 2a 2a 2a 2a |********|********|
|00004820| 0d 2a 2a 2a 20 31 2e 30 | 31 20 44 6f 43 6c 6f 73 |.*** 1.0|1 DoClos|
|00004830| 65 42 65 68 69 6e 64 28 | 77 69 6e 64 6f 77 29 20 |eBehind(|window) |
|00004840| 77 61 73 20 72 65 6d 6f | 76 65 64 20 2a 2a 2a 0d |was remo|ved ***.|
|00004850| 0d 09 31 2e 30 31 20 2d | 20 44 6f 43 6c 6f 73 65 |..1.01 -| DoClose|
|00004860| 42 65 68 69 6e 64 20 77 | 61 73 20 61 20 67 6f 6f |Behind w|as a goo|
|00004870| 64 20 69 64 65 61 20 66 | 6f 72 20 63 6c 6f 73 69 |d idea f|or closi|
|00004880| 6e 67 20 77 69 6e 64 6f | 77 73 20 77 68 65 6e 20 |ng windo|ws when |
|00004890| 71 75 69 74 74 69 6e 67 | 0d 09 61 6e 64 20 6e 6f |quitting|..and no|
|000048a0| 74 20 68 61 76 69 6e 67 | 20 74 6f 20 77 6f 72 72 |t having| to worr|
|000048b0| 79 20 61 62 6f 75 74 20 | 75 70 64 61 74 69 6e 67 |y about |updating|
|000048c0| 20 74 68 65 20 77 69 6e | 64 6f 77 73 2c 20 62 75 | the win|dows, bu|
|000048d0| 74 20 69 74 20 73 75 66 | 66 65 72 65 64 0d 09 66 |t it suf|fered..f|
|000048e0| 72 6f 6d 20 61 20 66 61 | 74 61 6c 20 66 6c 61 77 |rom a fa|tal flaw|
|000048f0| 2e 20 49 66 20 61 20 64 | 65 73 6b 20 61 63 63 65 |. If a d|esk acce|
|00004900| 73 73 6f 72 79 20 6f 77 | 6e 65 64 20 74 77 6f 20 |ssory ow|ned two |
|00004910| 77 69 6e 64 6f 77 73 2c | 20 69 74 20 77 6f 75 6c |windows,| it woul|
|00004920| 64 0d 09 63 6c 6f 73 65 | 20 62 6f 74 68 20 74 68 |d..close| both th|
|00004930| 6f 73 65 20 77 69 6e 64 | 6f 77 73 20 77 68 65 6e |ose wind|ows when|
|00004940| 20 43 6c 6f 73 65 44 65 | 73 6b 41 63 63 20 77 61 | CloseDe|skAcc wa|
|00004950| 73 20 63 61 6c 6c 65 64 | 2e 20 57 68 65 6e 20 44 |s called|. When D|
|00004960| 6f 43 6c 6f 73 65 42 65 | 68 69 6e 64 0d 09 67 6f |oCloseBe|hind..go|
|00004970| 74 20 61 72 6f 75 6e 64 | 20 74 6f 20 63 61 6c 6c |t around| to call|
|00004980| 69 6e 67 20 44 6f 43 6c | 6f 73 65 57 69 6e 64 6f |ing DoCl|oseWindo|
|00004990| 77 20 66 6f 72 20 74 68 | 61 74 20 6f 74 68 65 72 |w for th|at other|
|000049a0| 20 77 69 6e 64 6f 77 20 | 74 68 61 74 20 77 61 73 | window |that was|
|000049b0| 20 61 6c 72 65 61 64 79 | 0d 09 63 6c 6f 73 65 64 | already|..closed|
|000049c0| 2c 20 74 68 69 6e 67 73 | 20 77 6f 75 6c 64 20 67 |, things| would g|
|000049d0| 6f 20 76 65 72 79 20 70 | 6f 6f 72 6c 79 2e 20 41 |o very p|oorly. A|
|000049e0| 6e 6f 74 68 65 72 20 6f | 70 74 69 6f 6e 20 77 6f |nother o|ption wo|
|000049f0| 75 6c 64 20 62 65 20 74 | 6f 20 68 61 76 65 20 61 |uld be t|o have a|
|00004a00| 0d 09 70 72 6f 63 65 64 | 75 72 65 2c 20 47 65 74 |..proced|ure, Get|
|00004a10| 52 65 61 72 57 69 6e 64 | 6f 77 2c 20 74 68 61 74 |RearWind|ow, that|
|00004a20| 20 77 6f 75 6c 64 20 67 | 6f 20 74 68 72 6f 75 67 | would g|o throug|
|00004a30| 68 20 74 68 65 20 77 69 | 6e 64 6f 77 20 6c 69 73 |h the wi|ndow lis|
|00004a40| 74 20 61 6e 64 20 72 65 | 74 75 72 6e 0d 09 74 68 |t and re|turn..th|
|00004a50| 65 20 6c 61 73 74 20 77 | 69 6e 64 6f 77 2e 20 49 |e last w|indow. I|
|00004a60| 6e 73 74 65 61 64 2c 20 | 77 65 20 64 65 63 69 64 |nstead, |we decid|
|00004a70| 65 64 20 74 6f 20 70 72 | 65 73 65 6e 74 20 74 68 |ed to pr|esent th|
|00004a80| 65 20 73 74 61 6e 64 61 | 72 64 20 61 70 70 72 6f |e standa|rd appro|
|00004a90| 61 63 68 0d 09 6f 66 20 | 67 65 74 74 69 6e 67 20 |ach..of |getting |
|00004aa0| 61 6e 64 20 63 6c 6f 73 | 69 6e 67 20 46 72 6f 6e |and clos|ing Fron|
|00004ab0| 74 57 69 6e 64 6f 77 20 | 75 6e 74 69 6c 20 46 72 |tWindow |until Fr|
|00004ac0| 6f 6e 74 57 69 6e 64 6f | 77 20 72 65 74 75 72 6e |ontWindo|w return|
|00004ad0| 73 20 4e 49 4c 2e 20 54 | 68 69 73 0d 09 68 61 73 |s NIL. T|his..has|
|00004ae0| 20 61 20 70 6f 74 65 6e | 74 69 61 6c 20 62 65 6e | a poten|tial ben|
|00004af0| 65 66 69 74 20 69 6e 20 | 74 68 61 74 20 74 68 65 |efit in |that the|
|00004b00| 20 77 69 6e 64 6f 77 20 | 77 68 6f 73 65 20 64 6f | window |whose do|
|00004b10| 63 75 6d 65 6e 74 20 6e | 65 65 64 73 20 74 6f 20 |cument n|eeds to |
|00004b20| 62 65 20 73 61 76 65 64 | 0d 09 6d 61 79 20 62 65 |be saved|..may be|
|00004b30| 20 76 69 73 69 62 6c 65 | 20 73 69 6e 63 65 20 69 | visible| since i|
|00004b40| 74 20 69 73 20 74 68 65 | 20 66 72 6f 6e 74 20 77 |t is the| front w|
|00004b50| 69 6e 64 6f 77 2c 20 74 | 68 65 72 65 66 6f 72 65 |indow, t|herefore|
|00004b60| 20 64 65 63 72 65 61 73 | 69 6e 67 20 74 68 65 0d | decreas|ing the.|
|00004b70| 09 63 68 61 6e 63 65 20 | 6f 66 20 75 73 65 72 20 |.chance |of user |
|00004b80| 63 6f 6e 66 75 73 69 6f | 6e 2e 20 46 6f 72 20 61 |confusio|n. For a|
|00004b90| 65 73 74 68 65 74 69 63 | 20 72 65 61 73 6f 6e 73 |esthetic| reasons|
|00004ba0| 2c 20 74 68 65 20 77 69 | 6e 64 6f 77 73 20 69 6e |, the wi|ndows in|
|00004bb0| 20 74 68 65 0d 09 61 70 | 70 6c 69 63 61 74 69 6f | the..ap|plicatio|
|00004bc0| 6e 20 73 68 6f 75 6c 64 | 20 62 65 20 63 68 65 63 |n should| be chec|
|00004bd0| 6b 65 64 20 66 6f 72 20 | 75 70 64 61 74 65 73 20 |ked for |updates |
|00004be0| 70 65 72 69 6f 64 69 63 | 61 6c 6c 79 20 61 6e 64 |periodic|ally and|
|00004bf0| 20 68 61 76 65 20 74 68 | 65 0d 09 75 70 64 61 74 | have th|e..updat|
|00004c00| 65 73 20 73 65 72 76 69 | 63 65 64 2e 0d 2a 2a 2a |es servi|ced..***|
|00004c10| 2a 2a 2a 2a 2a 2a 2a 2a | 2a 2a 2a 2a 2a 2a 2a 2a |********|********|
|00004c20| 2a 2a 2a 2a 2a 2a 2a 2a | 2a 2a 2a 2a 2a 2a 2a 2a |********|********|
|00004c30| 2a 2a 2a 2a 2a 2a 2a 2a | 2a 2a 2a 2a 2a 2a 2a 2a |********|********|
|00004c40| 2a 2a 2a 2a 2a 2a 2a 2a | 2a 2a 2a 2a 2a 2a 2a 2a |********|********|
|00004c50| 2a 2a 2a 2a 2a 2a 2a 2a | 2a 2a 2a 2a 2a 2a 2a 2a |********|********|
|00004c60| 2a 2a 2a 2f 0d 0d 0d 2f | 2a 20 43 6c 65 61 6e 20 |***/.../|* Clean |
|00004c70| 75 70 20 74 68 65 20 61 | 70 70 6c 69 63 61 74 69 |up the a|pplicati|
|00004c80| 6f 6e 20 61 6e 64 20 65 | 78 69 74 2e 20 57 65 20 |on and e|xit. We |
|00004c90| 63 6c 6f 73 65 20 61 6c | 6c 20 6f 66 20 74 68 65 |close al|l of the|
|00004ca0| 20 77 69 6e 64 6f 77 73 | 20 73 6f 20 74 68 61 74 | windows| so that|
|00004cb0| 0d 20 74 68 65 79 20 63 | 61 6e 20 75 70 64 61 74 |. they c|an updat|
|00004cc0| 65 20 74 68 65 69 72 20 | 64 6f 63 75 6d 65 6e 74 |e their |document|
|00004cd0| 73 2c 20 69 66 20 61 6e | 79 2e 20 2a 2f 0d 20 0d |s, if an|y. */. .|
|00004ce0| 2f 2a 09 31 2e 30 31 20 | 2d 20 49 66 20 77 65 20 |/*.1.01 |- If we |
|00004cf0| 66 69 6e 64 20 6f 75 74 | 20 74 68 61 74 20 61 20 |find out| that a |
|00004d00| 63 61 6e 63 65 6c 20 68 | 61 73 20 6f 63 63 75 72 |cancel h|as occur|
|00004d10| 72 65 64 2c 20 77 65 20 | 77 6f 6e 27 74 20 65 78 |red, we |won't ex|
|00004d20| 69 74 20 74 6f 20 74 68 | 65 0d 09 73 68 65 6c 6c |it to th|e..shell|
|00004d30| 2c 20 62 75 74 20 77 69 | 6c 6c 20 72 65 74 75 72 |, but wi|ll retur|
|00004d40| 6e 20 69 6e 73 74 65 61 | 64 2e 20 2a 2f 0d 0d 23 |n instea|d. */..#|
|00004d50| 70 72 61 67 6d 61 20 73 | 65 67 6d 65 6e 74 20 4d |pragma s|egment M|
|00004d60| 61 69 6e 0d 76 6f 69 64 | 20 54 65 72 6d 69 6e 61 |ain.void| Termina|
|00004d70| 74 65 28 29 0d 7b 0d 09 | 57 69 6e 64 6f 77 50 74 |te().{..|WindowPt|
|00004d80| 72 09 61 57 69 6e 64 6f | 77 3b 0d 09 42 6f 6f 6c |r.aWindo|w;..Bool|
|00004d90| 65 61 6e 09 09 63 6c 6f | 73 65 64 3b 0d 09 0d 09 |ean..clo|sed;....|
|00004da0| 63 6c 6f 73 65 64 20 3d | 20 74 72 75 65 3b 0d 09 |closed =| true;..|
|00004db0| 64 6f 20 7b 0d 09 09 61 | 57 69 6e 64 6f 77 20 3d |do {...a|Window =|
|00004dc0| 20 46 72 6f 6e 74 57 69 | 6e 64 6f 77 28 29 3b 09 | FrontWi|ndow();.|
|00004dd0| 09 09 09 2f 2a 20 67 65 | 74 20 74 68 65 20 63 75 |.../* ge|t the cu|
|00004de0| 72 72 65 6e 74 20 66 72 | 6f 6e 74 20 77 69 6e 64 |rrent fr|ont wind|
|00004df0| 6f 77 20 2a 2f 0d 09 09 | 69 66 20 28 61 57 69 6e |ow */...|if (aWin|
|00004e00| 64 6f 77 20 21 3d 20 6e | 69 6c 29 0d 09 09 09 63 |dow != n|il)....c|
|00004e10| 6c 6f 73 65 64 20 3d 20 | 44 6f 43 6c 6f 73 65 57 |losed = |DoCloseW|
|00004e20| 69 6e 64 6f 77 28 61 57 | 69 6e 64 6f 77 29 3b 09 |indow(aW|indow);.|
|00004e30| 2f 2a 20 63 6c 6f 73 65 | 20 74 68 69 73 20 77 69 |/* close| this wi|
|00004e40| 6e 64 6f 77 20 2a 2f 09 | 0d 09 7d 0d 09 77 68 69 |ndow */.|..}..whi|
|00004e50| 6c 65 20 28 63 6c 6f 73 | 65 64 20 26 26 20 28 61 |le (clos|ed && (a|
|00004e60| 57 69 6e 64 6f 77 20 21 | 3d 20 6e 69 6c 29 29 3b |Window !|= nil));|
|00004e70| 0d 09 69 66 20 28 63 6c | 6f 73 65 64 29 0d 09 09 |..if (cl|osed)...|
|00004e80| 45 78 69 74 54 6f 53 68 | 65 6c 6c 28 29 3b 09 09 |ExitToSh|ell();..|
|00004e90| 09 09 09 09 09 2f 2a 20 | 65 78 69 74 20 69 66 20 |...../* |exit if |
|00004ea0| 6e 6f 20 63 61 6e 63 65 | 6c 6c 61 74 69 6f 6e 20 |no cance|llation |
|00004eb0| 2a 2f 0d 7d 20 2f 2a 54 | 65 72 6d 69 6e 61 74 65 |*/.} /*T|erminate|
|00004ec0| 2a 2f 0d 0d 0d 2f 2a 09 | 53 65 74 20 75 70 20 74 |*/.../*.|Set up t|
|00004ed0| 68 65 20 77 68 6f 6c 65 | 20 77 6f 72 6c 64 2c 20 |he whole| world, |
|00004ee0| 69 6e 63 6c 75 64 69 6e | 67 20 67 6c 6f 62 61 6c |includin|g global|
|00004ef0| 20 76 61 72 69 61 62 6c | 65 73 2c 20 54 6f 6f 6c | variabl|es, Tool|
|00004f00| 62 6f 78 20 6d 61 6e 61 | 67 65 72 73 2c 0d 09 61 |box mana|gers,..a|
|00004f10| 6e 64 20 6d 65 6e 75 73 | 2e 20 57 65 20 61 6c 73 |nd menus|. We als|
|00004f20| 6f 20 63 72 65 61 74 65 | 20 6f 75 72 20 6f 6e 65 |o create| our one|
|00004f30| 20 61 70 70 6c 69 63 61 | 74 69 6f 6e 20 77 69 6e | applica|tion win|
|00004f40| 64 6f 77 20 61 74 20 74 | 68 69 73 20 74 69 6d 65 |dow at t|his time|
|00004f50| 2e 0d 09 53 69 6e 63 65 | 20 77 69 6e 64 6f 77 20 |...Since| window |
|00004f60| 73 74 6f 72 61 67 65 20 | 69 73 20 6e 6f 6e 2d 72 |storage |is non-r|
|00004f70| 65 6c 6f 63 61 74 65 61 | 62 6c 65 2c 20 68 6f 77 |elocatea|ble, how|
|00004f80| 20 61 6e 64 20 77 68 65 | 6e 20 74 6f 20 61 6c 6c | and whe|n to all|
|00004f90| 6f 63 61 74 65 20 73 70 | 61 63 65 0d 09 66 6f 72 |ocate sp|ace..for|
|00004fa0| 20 77 69 6e 64 6f 77 73 | 20 69 73 20 76 65 72 79 | windows| is very|
|00004fb0| 20 69 6d 70 6f 72 74 61 | 6e 74 20 73 6f 20 74 68 | importa|nt so th|
|00004fc0| 61 74 20 68 65 61 70 20 | 66 72 61 67 6d 65 6e 74 |at heap |fragment|
|00004fd0| 61 74 69 6f 6e 20 64 6f | 65 73 20 6e 6f 74 20 6f |ation do|es not o|
|00004fe0| 63 63 75 72 2e 0d 09 42 | 65 63 61 75 73 65 20 53 |ccur...B|ecause S|
|00004ff0| 61 6d 70 6c 65 20 68 61 | 73 20 6f 6e 6c 79 20 6f |ample ha|s only o|
|00005000| 6e 65 20 77 69 6e 64 6f | 77 20 61 6e 64 20 69 74 |ne windo|w and it|
|00005010| 20 69 73 20 6f 6e 6c 79 | 20 64 69 73 70 6f 73 65 | is only| dispose|
|00005020| 64 20 77 68 65 6e 20 74 | 68 65 20 61 70 70 6c 69 |d when t|he appli|
|00005030| 63 61 74 69 6f 6e 0d 09 | 71 75 69 74 73 2c 20 77 |cation..|quits, w|
|00005040| 65 20 77 69 6c 6c 20 61 | 6c 6c 6f 63 61 74 65 20 |e will a|llocate |
|00005050| 69 74 73 20 73 70 61 63 | 65 20 68 65 72 65 2c 20 |its spac|e here, |
|00005060| 62 65 66 6f 72 65 20 61 | 6e 79 74 68 69 6e 67 20 |before a|nything |
|00005070| 74 68 61 74 20 6d 69 67 | 68 74 20 62 65 20 61 20 |that mig|ht be a |
|00005080| 6c 6f 63 6b 65 64 0d 09 | 72 65 6c 6f 63 61 74 61 |locked..|relocata|
|00005090| 62 6c 65 20 6f 62 6a 65 | 63 74 20 67 65 74 73 20 |ble obje|ct gets |
|000050a0| 69 6e 74 6f 20 74 68 65 | 20 68 65 61 70 2e 20 54 |into the| heap. T|
|000050b0| 68 69 73 20 77 61 79 2c | 20 77 65 20 63 61 6e 20 |his way,| we can |
|000050c0| 66 6f 72 63 65 20 74 68 | 65 20 73 74 6f 72 61 67 |force th|e storag|
|000050d0| 65 20 74 6f 20 62 65 0d | 09 69 6e 20 74 68 65 20 |e to be.|.in the |
|000050e0| 6c 6f 77 65 73 74 20 6d | 65 6d 6f 72 79 20 61 76 |lowest m|emory av|
|000050f0| 61 69 6c 61 62 6c 65 20 | 69 6e 20 74 68 65 20 68 |ailable |in the h|
|00005100| 65 61 70 2e 20 57 69 6e | 64 6f 77 20 73 74 6f 72 |eap. Win|dow stor|
|00005110| 61 67 65 20 63 61 6e 20 | 64 69 66 66 65 72 20 77 |age can |differ w|
|00005120| 69 64 65 6c 79 0d 09 61 | 6d 6f 6e 67 73 74 20 61 |idely..a|mongst a|
|00005130| 70 70 6c 69 63 61 74 69 | 6f 6e 73 20 64 65 70 65 |pplicati|ons depe|
|00005140| 6e 64 69 6e 67 20 6f 6e | 20 68 6f 77 20 6d 61 6e |nding on| how man|
|00005150| 79 20 77 69 6e 64 6f 77 | 73 20 61 72 65 20 63 72 |y window|s are cr|
|00005160| 65 61 74 65 64 20 61 6e | 64 20 64 69 73 70 6f 73 |eated an|d dispos|
|00005170| 65 64 2e 20 2a 2f 0d 0d | 2f 2a 09 31 2e 30 31 20 |ed. */..|/*.1.01 |
|00005180| 2d 20 54 68 65 20 63 6f | 64 65 20 74 68 61 74 20 |- The co|de that |
|00005190| 75 73 65 64 20 74 6f 20 | 62 65 20 70 61 72 74 20 |used to |be part |
|000051a0| 6f 66 20 46 6f 72 63 65 | 45 6e 76 69 72 6f 6e 73 |of Force|Environs|
|000051b0| 20 68 61 73 20 62 65 65 | 6e 20 6d 6f 76 65 64 20 | has bee|n moved |
|000051c0| 69 6e 74 6f 0d 09 74 68 | 69 73 20 6d 6f 64 75 6c |into..th|is modul|
|000051d0| 65 2e 20 49 66 20 61 6e | 20 65 72 72 6f 72 20 69 |e. If an| error i|
|000051e0| 73 20 64 65 74 65 63 74 | 65 64 2c 20 69 6e 73 74 |s detect|ed, inst|
|000051f0| 65 61 64 20 6f 66 20 6d | 65 72 65 6c 79 20 64 6f |ead of m|erely do|
|00005200| 69 6e 67 20 61 6e 20 45 | 78 69 74 54 6f 53 68 65 |ing an E|xitToShe|
|00005210| 6c 6c 2c 0d 09 77 68 69 | 63 68 20 6c 65 61 76 65 |ll,..whi|ch leave|
|00005220| 73 20 74 68 65 20 75 73 | 65 72 20 77 69 74 68 6f |s the us|er witho|
|00005230| 75 74 20 6d 75 63 68 20 | 74 6f 20 67 6f 20 6f 6e |ut much |to go on|
|00005240| 2c 20 77 65 20 63 61 6c | 6c 20 41 6c 65 72 74 55 |, we cal|l AlertU|
|00005250| 73 65 72 2c 20 77 68 69 | 63 68 20 70 75 74 73 0d |ser, whi|ch puts.|
|00005260| 09 75 70 20 61 20 73 69 | 6d 70 6c 65 20 61 6c 65 |.up a si|mple ale|
|00005270| 72 74 20 74 68 61 74 20 | 6a 75 73 74 20 73 61 79 |rt that |just say|
|00005280| 73 20 61 6e 20 65 72 72 | 6f 72 20 6f 63 63 75 72 |s an err|or occur|
|00005290| 72 65 64 20 61 6e 64 20 | 74 68 65 6e 20 63 61 6c |red and |then cal|
|000052a0| 6c 73 20 45 78 69 74 54 | 6f 53 68 65 6c 6c 2e 0d |ls ExitT|oShell..|
|000052b0| 09 53 69 6e 63 65 20 74 | 68 65 72 65 20 69 73 20 |.Since t|here is |
|000052c0| 6e 6f 20 6f 74 68 65 72 | 20 63 6c 65 61 6e 75 70 |no other| cleanup|
|000052d0| 20 6e 65 65 64 65 64 20 | 61 74 20 74 68 69 73 20 | needed |at this |
|000052e0| 70 6f 69 6e 74 20 69 66 | 20 61 6e 20 65 72 72 6f |point if| an erro|
|000052f0| 72 20 69 73 20 64 65 74 | 65 63 74 65 64 2c 0d 09 |r is det|ected,..|
|00005300| 74 68 69 73 20 66 6f 72 | 6d 20 6f 66 20 65 72 72 |this for|m of err|
|00005310| 6f 72 2d 20 68 61 6e 64 | 6c 69 6e 67 20 69 73 20 |or- hand|ling is |
|00005320| 61 63 63 65 70 74 61 62 | 6c 65 2e 20 49 66 20 6d |acceptab|le. If m|
|00005330| 6f 72 65 20 73 6f 70 68 | 69 73 74 69 63 61 74 65 |ore soph|isticate|
|00005340| 64 20 65 72 72 6f 72 20 | 72 65 63 6f 76 65 72 79 |d error |recovery|
|00005350| 0d 09 69 73 20 6e 65 65 | 64 65 64 2c 20 61 6e 20 |..is nee|ded, an |
|00005360| 65 78 63 65 70 74 69 6f | 6e 20 6d 65 63 68 61 6e |exceptio|n mechan|
|00005370| 69 73 6d 2c 20 73 75 63 | 68 20 61 73 20 69 73 20 |ism, suc|h as is |
|00005380| 70 72 6f 76 69 64 65 64 | 20 62 79 20 53 69 67 6e |provided| by Sign|
|00005390| 61 6c 73 2c 20 63 61 6e | 20 62 65 20 75 73 65 64 |als, can| be used|
|000053a0| 2e 20 2a 2f 0d 0d 23 70 | 72 61 67 6d 61 20 73 65 |. */..#p|ragma se|
|000053b0| 67 6d 65 6e 74 20 49 6e | 69 74 69 61 6c 69 7a 65 |gment In|itialize|
|000053c0| 0d 76 6f 69 64 20 49 6e | 69 74 69 61 6c 69 7a 65 |.void In|itialize|
|000053d0| 28 29 0d 7b 0d 09 48 61 | 6e 64 6c 65 09 09 6d 65 |().{..Ha|ndle..me|
|000053e0| 6e 75 42 61 72 3b 0d 09 | 57 69 6e 64 6f 77 50 74 |nuBar;..|WindowPt|
|000053f0| 72 09 77 69 6e 64 6f 77 | 3b 0d 09 6c 6f 6e 67 09 |r.window|;..long.|
|00005400| 09 74 6f 74 61 6c 2c 20 | 63 6f 6e 74 69 67 3b 0d |.total, |contig;.|
|00005410| 09 45 76 65 6e 74 52 65 | 63 6f 72 64 20 65 76 65 |.EventRe|cord eve|
|00005420| 6e 74 3b 0d 09 73 68 6f | 72 74 09 09 63 6f 75 6e |nt;..sho|rt..coun|
|00005430| 74 3b 0d 0d 09 67 49 6e | 42 61 63 6b 67 72 6f 75 |t;...gIn|Backgrou|
|00005440| 6e 64 20 3d 20 66 61 6c | 73 65 3b 0d 0d 09 49 6e |nd = fal|se;...In|
|00005450| 69 74 47 72 61 66 28 28 | 50 74 72 29 20 26 71 64 |itGraf((|Ptr) &qd|
|00005460| 2e 74 68 65 50 6f 72 74 | 29 3b 0d 09 49 6e 69 74 |.thePort|);..Init|
|00005470| 46 6f 6e 74 73 28 29 3b | 0d 09 49 6e 69 74 57 69 |Fonts();|..InitWi|
|00005480| 6e 64 6f 77 73 28 29 3b | 0d 09 49 6e 69 74 4d 65 |ndows();|..InitMe|
|00005490| 6e 75 73 28 29 3b 0d 09 | 54 45 49 6e 69 74 28 29 |nus();..|TEInit()|
|000054a0| 3b 0d 09 49 6e 69 74 44 | 69 61 6c 6f 67 73 28 6e |;..InitD|ialogs(n|
|000054b0| 69 6c 29 3b 0d 09 49 6e | 69 74 43 75 72 73 6f 72 |il);..In|itCursor|
|000054c0| 28 29 3b 0d 09 0d 09 2f | 2a 09 43 61 6c 6c 20 4d |();..../|*.Call M|
|000054d0| 50 50 4f 70 65 6e 20 61 | 6e 64 20 41 54 50 4c 6f |PPOpen a|nd ATPLo|
|000054e0| 61 64 20 61 74 20 74 68 | 69 73 20 70 6f 69 6e 74 |ad at th|is point|
|000054f0| 20 74 6f 20 69 6e 69 74 | 69 61 6c 69 7a 65 20 41 | to init|ialize A|
|00005500| 70 70 6c 65 54 61 6c 6b | 2c 0d 09 20 09 69 66 20 |ppleTalk|,.. .if |
|00005510| 79 6f 75 20 61 72 65 20 | 75 73 69 6e 67 20 69 74 |you are |using it|
|00005520| 2e 20 2a 2f 0d 09 2f 2a | 09 4e 4f 54 45 20 2d 2d |. */../*|.NOTE --|
|00005530| 20 49 74 20 69 73 20 6e | 6f 20 6c 6f 6e 67 65 72 | It is n|o longer|
|00005540| 20 6e 65 63 65 73 73 61 | 72 79 2c 20 61 6e 64 20 | necessa|ry, and |
|00005550| 61 63 74 75 61 6c 6c 79 | 20 75 6e 68 65 61 6c 74 |actually| unhealt|
|00005560| 68 79 2c 20 74 6f 20 63 | 68 65 63 6b 0d 09 09 50 |hy, to c|heck...P|
|00005570| 6f 72 74 42 55 73 65 20 | 61 6e 64 20 53 50 43 6f |ortBUse |and SPCo|
|00005580| 6e 66 69 67 20 62 65 66 | 6f 72 65 20 6f 70 65 6e |nfig bef|ore open|
|00005590| 69 6e 67 20 41 70 70 6c | 65 54 61 6c 6b 2e 20 54 |ing Appl|eTalk. T|
|000055a0| 68 65 20 64 72 69 76 65 | 72 73 20 61 72 65 20 63 |he drive|rs are c|
|000055b0| 61 70 61 62 6c 65 0d 09 | 09 6f 66 20 63 68 65 63 |apable..|.of chec|
|000055c0| 6b 69 6e 67 20 66 6f 72 | 20 70 6f 72 74 20 61 76 |king for| port av|
|000055d0| 61 69 6c 61 62 69 6c 69 | 74 79 20 74 68 65 6d 73 |ailabili|ty thems|
|000055e0| 65 6c 76 65 73 2e 20 2a | 2f 0d 09 0d 09 2f 2a 09 |elves. *|/..../*.|
|000055f0| 54 68 69 73 20 6e 65 78 | 74 20 62 69 74 20 6f 66 |This nex|t bit of|
|00005600| 20 63 6f 64 65 20 69 73 | 20 6e 65 63 65 73 73 61 | code is| necessa|
|00005610| 72 79 20 74 6f 20 61 6c | 6c 6f 77 20 74 68 65 20 |ry to al|low the |
|00005620| 64 65 66 61 75 6c 74 20 | 62 75 74 74 6f 6e 20 6f |default |button o|
|00005630| 66 20 6f 75 72 0d 09 09 | 61 6c 65 72 74 20 62 65 |f our...|alert be|
|00005640| 20 6f 75 74 6c 69 6e 65 | 64 2e 0d 09 09 31 2e 30 | outline|d....1.0|
|00005650| 32 20 2d 20 43 68 61 6e | 67 65 64 20 74 6f 20 63 |2 - Chan|ged to c|
|00005660| 61 6c 6c 20 45 76 65 6e | 74 41 76 61 69 6c 20 73 |all Even|tAvail s|
|00005670| 6f 20 74 68 61 74 20 77 | 65 20 64 6f 6e 27 74 20 |o that w|e don't |
|00005680| 6c 6f 73 65 20 73 6f 6d | 65 20 69 6d 70 6f 72 74 |lose som|e import|
|00005690| 61 6e 74 0d 09 09 65 76 | 65 6e 74 73 2e 20 2a 2f |ant...ev|ents. */|
|000056a0| 0d 09 20 0d 09 66 6f 72 | 20 28 63 6f 75 6e 74 20 |.. ..for| (count |
|000056b0| 3d 20 31 3b 20 63 6f 75 | 6e 74 20 3c 3d 20 33 3b |= 1; cou|nt <= 3;|
|000056c0| 20 63 6f 75 6e 74 2b 2b | 29 0d 09 09 45 76 65 6e | count++|)...Even|
|000056d0| 74 41 76 61 69 6c 28 65 | 76 65 72 79 45 76 65 6e |tAvail(e|veryEven|
|000056e0| 74 2c 20 26 65 76 65 6e | 74 29 3b 0d 09 0d 09 2f |t, &even|t);..../|
|000056f0| 2a 09 49 67 6e 6f 72 65 | 20 74 68 65 20 65 72 72 |*.Ignore| the err|
|00005700| 6f 72 20 72 65 74 75 72 | 6e 65 64 20 66 72 6f 6d |or retur|ned from|
|00005710| 20 53 79 73 45 6e 76 69 | 72 6f 6e 73 3b 20 65 76 | SysEnvi|rons; ev|
|00005720| 65 6e 20 69 66 20 61 6e | 20 65 72 72 6f 72 20 6f |en if an| error o|
|00005730| 63 63 75 72 72 65 64 2c | 0d 09 09 74 68 65 20 53 |ccurred,|...the S|
|00005740| 79 73 45 6e 76 69 72 6f | 6e 73 20 67 6c 75 65 20 |ysEnviro|ns glue |
|00005750| 77 69 6c 6c 20 66 69 6c | 6c 20 69 6e 20 74 68 65 |will fil|l in the|
|00005760| 20 53 79 73 45 6e 76 52 | 65 63 2e 20 59 6f 75 20 | SysEnvR|ec. You |
|00005770| 63 61 6e 20 73 61 76 65 | 20 61 20 72 65 64 75 6e |can save| a redun|
|00005780| 64 61 6e 74 0d 09 09 63 | 61 6c 6c 20 74 6f 20 53 |dant...c|all to S|
|00005790| 79 73 45 6e 76 69 72 6f | 6e 73 20 62 79 20 63 61 |ysEnviro|ns by ca|
|000057a0| 6c 6c 69 6e 67 20 69 74 | 20 61 66 74 65 72 20 69 |lling it| after i|
|000057b0| 6e 69 74 69 61 6c 69 7a | 69 6e 67 20 41 70 70 6c |nitializ|ing Appl|
|000057c0| 65 54 61 6c 6b 2e 20 2a | 2f 0d 09 20 0d 09 53 79 |eTalk. *|/.. ..Sy|
|000057d0| 73 45 6e 76 69 72 6f 6e | 73 28 6b 53 79 73 45 6e |sEnviron|s(kSysEn|
|000057e0| 76 69 72 6f 6e 73 56 65 | 72 73 69 6f 6e 2c 20 26 |vironsVe|rsion, &|
|000057f0| 67 4d 61 63 29 3b 0d 09 | 0d 09 2f 2a 20 4d 61 6b |gMac);..|../* Mak|
|00005800| 65 20 73 75 72 65 20 74 | 68 61 74 20 74 68 65 20 |e sure t|hat the |
|00005810| 6d 61 63 68 69 6e 65 20 | 68 61 73 20 61 74 20 6c |machine |has at l|
|00005820| 65 61 73 74 20 31 32 38 | 4b 20 52 4f 4d 73 2e 20 |east 128|K ROMs. |
|00005830| 49 66 20 69 74 20 64 6f | 65 73 6e 27 74 2c 20 65 |If it do|esn't, e|
|00005840| 78 69 74 2e 20 2a 2f 0d | 09 0d 09 69 66 20 28 67 |xit. */.|...if (g|
|00005850| 4d 61 63 2e 6d 61 63 68 | 69 6e 65 54 79 70 65 20 |Mac.mach|ineType |
|00005860| 3c 20 30 29 20 41 6c 65 | 72 74 55 73 65 72 28 29 |< 0) Ale|rtUser()|
|00005870| 3b 0d 09 0d 09 2f 2a 09 | 31 2e 30 32 20 2d 20 4d |;..../*.|1.02 - M|
|00005880| 6f 76 65 20 54 72 61 70 | 41 76 61 69 6c 61 62 6c |ove Trap|Availabl|
|00005890| 65 20 63 61 6c 6c 20 74 | 6f 20 61 66 74 65 72 20 |e call t|o after |
|000058a0| 53 79 73 45 6e 76 69 72 | 6f 6e 73 20 73 6f 20 74 |SysEnvir|ons so t|
|000058b0| 68 61 74 20 77 65 20 63 | 61 6e 20 74 65 6c 6c 0d |hat we c|an tell.|
|000058c0| 09 09 69 6e 20 54 72 61 | 70 41 76 61 69 6c 61 62 |..in Tra|pAvailab|
|000058d0| 6c 65 20 69 66 20 61 20 | 74 6f 6f 6c 20 74 72 61 |le if a |tool tra|
|000058e0| 70 20 76 61 6c 75 65 20 | 69 73 20 6f 75 74 20 6f |p value |is out o|
|000058f0| 66 20 72 61 6e 67 65 2e | 20 2a 2f 0d 09 09 0d 09 |f range.| */.....|
|00005900| 67 48 61 73 57 61 69 74 | 4e 65 78 74 45 76 65 6e |gHasWait|NextEven|
|00005910| 74 20 3d 20 54 72 61 70 | 41 76 61 69 6c 61 62 6c |t = Trap|Availabl|
|00005920| 65 28 5f 57 61 69 74 4e | 65 78 74 45 76 65 6e 74 |e(_WaitN|extEvent|
|00005930| 2c 20 54 6f 6f 6c 54 72 | 61 70 29 3b 0d 0d 0d 09 |, ToolTr|ap);....|
|00005940| 2f 2a 09 31 2e 30 31 20 | 2d 20 57 65 20 75 73 65 |/*.1.01 |- We use|
|00005950| 64 20 74 6f 20 6d 61 6b | 65 20 61 20 63 68 65 63 |d to mak|e a chec|
|00005960| 6b 20 66 6f 72 20 6d 65 | 6d 6f 72 79 20 61 74 20 |k for me|mory at |
|00005970| 74 68 69 73 20 70 6f 69 | 6e 74 20 62 79 20 65 78 |this poi|nt by ex|
|00005980| 61 6d 69 6e 69 6e 67 20 | 41 70 70 6c 4c 69 6d 69 |amining |ApplLimi|
|00005990| 74 2c 0d 09 09 41 70 70 | 6c 69 63 5a 6f 6e 65 2c |t,...App|licZone,|
|000059a0| 20 61 6e 64 20 53 74 61 | 63 6b 53 70 61 63 65 20 | and Sta|ckSpace |
|000059b0| 61 6e 64 20 63 6f 6d 70 | 61 72 69 6e 67 20 74 68 |and comp|aring th|
|000059c0| 61 74 20 74 6f 20 74 68 | 65 20 6d 69 6e 69 6d 75 |at to th|e minimu|
|000059d0| 6d 20 73 69 7a 65 20 77 | 65 20 74 6f 6c 64 0d 09 |m size w|e told..|
|000059e0| 09 4d 75 6c 74 69 46 69 | 6e 64 65 72 20 77 65 20 |.MultiFi|nder we |
|000059f0| 6e 65 65 64 65 64 2e 20 | 54 68 69 73 20 64 69 64 |needed. |This did|
|00005a00| 20 6e 6f 74 20 77 6f 72 | 6b 20 77 65 6c 6c 20 62 | not wor|k well b|
|00005a10| 65 63 61 75 73 65 20 69 | 74 20 61 73 73 75 6d 65 |ecause i|t assume|
|00005a20| 64 20 74 6f 6f 20 6d 75 | 63 68 20 61 62 6f 75 74 |d too mu|ch about|
|00005a30| 0d 09 09 74 68 65 20 72 | 65 6c 61 74 69 6f 6e 73 |...the r|elations|
|00005a40| 68 69 70 20 62 65 74 77 | 65 65 6e 20 77 68 61 74 |hip betw|een what|
|00005a50| 20 77 65 20 61 73 6b 65 | 64 20 4d 75 6c 74 69 46 | we aske|d MultiF|
|00005a60| 69 6e 64 65 72 20 66 6f | 72 20 61 6e 64 20 77 68 |inder fo|r and wh|
|00005a70| 61 74 20 77 65 20 77 6f | 75 6c 64 20 61 63 74 75 |at we wo|uld actu|
|00005a80| 61 6c 6c 79 0d 09 09 67 | 65 74 20 62 61 63 6b 2c |ally...g|et back,|
|00005a90| 20 61 73 20 77 65 6c 6c | 20 61 73 20 68 6f 77 20 | as well| as how |
|00005aa0| 74 6f 20 6d 65 61 73 75 | 72 65 20 69 74 2e 20 49 |to measu|re it. I|
|00005ab0| 6e 73 74 65 61 64 2c 20 | 77 65 20 77 69 6c 6c 20 |nstead, |we will |
|00005ac0| 75 73 65 20 61 6e 20 61 | 6c 74 65 72 6e 61 74 65 |use an a|lternate|
|00005ad0| 0d 09 09 6d 65 74 68 6f | 64 20 63 6f 6d 70 72 69 |...metho|d compri|
|00005ae0| 73 65 64 20 6f 66 20 74 | 77 6f 20 73 74 65 70 73 |sed of t|wo steps|
|00005af0| 2e 20 2a 2f 0d 09 20 0d | 09 2f 2a 09 49 74 20 69 |. */.. .|./*.It i|
|00005b00| 73 20 62 65 74 74 65 72 | 20 74 6f 20 66 69 72 73 |s better| to firs|
|00005b10| 74 20 63 68 65 63 6b 20 | 74 68 65 20 73 69 7a 65 |t check |the size|
|00005b20| 20 6f 66 20 74 68 65 20 | 61 70 70 6c 69 63 61 74 | of the |applicat|
|00005b30| 69 6f 6e 20 68 65 61 70 | 20 61 67 61 69 6e 73 74 |ion heap| against|
|00005b40| 20 61 20 76 61 6c 75 65 | 0d 09 09 74 68 61 74 20 | a value|...that |
|00005b50| 79 6f 75 20 68 61 76 65 | 20 64 65 74 65 72 6d 69 |you have| determi|
|00005b60| 6e 65 64 20 69 73 20 74 | 68 65 20 73 6d 61 6c 6c |ned is t|he small|
|00005b70| 65 73 74 20 68 65 61 70 | 20 74 68 65 20 61 70 70 |est heap| the app|
|00005b80| 6c 69 63 61 74 69 6f 6e | 20 63 61 6e 20 72 65 61 |lication| can rea|
|00005b90| 73 6f 6e 61 62 6c 79 0d | 09 09 77 6f 72 6b 20 69 |sonably.|..work i|
|00005ba0| 6e 2e 20 54 68 69 73 20 | 6e 75 6d 62 65 72 20 73 |n. This |number s|
|00005bb0| 68 6f 75 6c 64 20 62 65 | 20 64 65 72 69 76 65 64 |hould be| derived|
|00005bc0| 20 62 79 20 65 78 61 6d | 69 6e 69 6e 67 20 74 68 | by exam|ining th|
|00005bd0| 65 20 73 69 7a 65 20 6f | 66 20 74 68 65 20 68 65 |e size o|f the he|
|00005be0| 61 70 20 74 68 61 74 0d | 09 09 69 73 20 61 63 74 |ap that.|..is act|
|00005bf0| 75 61 6c 6c 79 20 70 72 | 6f 76 69 64 65 64 20 62 |ually pr|ovided b|
|00005c00| 79 20 4d 75 6c 74 69 46 | 69 6e 64 65 72 20 77 68 |y MultiF|inder wh|
|00005c10| 65 6e 20 74 68 65 20 6d | 69 6e 69 6d 75 6d 20 73 |en the m|inimum s|
|00005c20| 69 7a 65 20 72 65 71 75 | 65 73 74 65 64 20 69 73 |ize requ|ested is|
|00005c30| 20 75 73 65 64 2e 0d 09 | 09 54 68 65 20 64 65 72 | used...|.The der|
|00005c40| 69 76 61 74 69 6f 6e 20 | 6f 66 20 74 68 65 20 6d |ivation |of the m|
|00005c50| 69 6e 69 6d 75 6d 20 73 | 69 7a 65 20 72 65 71 75 |inimum s|ize requ|
|00005c60| 65 73 74 65 64 20 66 72 | 6f 6d 20 4d 75 6c 74 69 |ested fr|om Multi|
|00005c70| 46 69 6e 64 65 72 20 69 | 73 20 64 65 73 63 72 69 |Finder i|s descri|
|00005c80| 62 65 64 0d 09 09 69 6e | 20 53 61 6d 70 6c 65 2e |bed...in| Sample.|
|00005c90| 68 2e 20 54 68 65 20 63 | 68 65 63 6b 20 73 68 6f |h. The c|heck sho|
|00005ca0| 75 6c 64 20 62 65 20 6d | 61 64 65 20 62 65 63 61 |uld be m|ade beca|
|00005cb0| 75 73 65 20 74 68 65 20 | 70 72 65 66 65 72 72 65 |use the |preferre|
|00005cc0| 64 20 73 69 7a 65 20 63 | 61 6e 20 65 6e 64 20 75 |d size c|an end u|
|00005cd0| 70 0d 09 09 62 65 69 6e | 67 20 73 65 74 20 73 6d |p...bein|g set sm|
|00005ce0| 61 6c 6c 65 72 20 74 68 | 61 6e 20 74 68 65 20 6d |aller th|an the m|
|00005cf0| 69 6e 69 6d 75 6d 20 73 | 69 7a 65 20 62 79 20 74 |inimum s|ize by t|
|00005d00| 68 65 20 75 73 65 72 2e | 20 54 68 69 73 20 65 78 |he user.| This ex|
|00005d10| 74 72 61 20 63 68 65 63 | 6b 20 61 63 74 73 20 74 |tra chec|k acts t|
|00005d20| 6f 0d 09 09 69 6e 73 75 | 72 65 20 74 68 61 74 20 |o...insu|re that |
|00005d30| 79 6f 75 72 20 61 70 70 | 6c 69 63 61 74 69 6f 6e |your app|lication|
|00005d40| 20 69 73 20 73 74 61 72 | 74 69 6e 67 20 66 72 6f | is star|ting fro|
|00005d50| 6d 20 61 20 73 6f 6c 69 | 64 20 6d 65 6d 6f 72 79 |m a soli|d memory|
|00005d60| 20 66 6f 75 6e 64 61 74 | 69 6f 6e 2e 20 2a 2f 0d | foundat|ion. */.|
|00005d70| 09 20 0d 09 69 66 20 28 | 28 6c 6f 6e 67 29 20 47 |. ..if (|(long) G|
|00005d80| 65 74 41 70 70 6c 4c 69 | 6d 69 74 28 29 20 2d 20 |etApplLi|mit() - |
|00005d90| 28 6c 6f 6e 67 29 20 41 | 70 70 6c 69 63 5a 6f 6e |(long) A|pplicZon|
|00005da0| 65 28 29 20 3c 20 6b 4d | 69 6e 48 65 61 70 29 20 |e() < kM|inHeap) |
|00005db0| 41 6c 65 72 74 55 73 65 | 72 28 29 3b 0d 09 0d 09 |AlertUse|r();....|
|00005dc0| 2f 2a 09 4e 65 78 74 2c | 20 6d 61 6b 65 20 73 75 |/*.Next,| make su|
|00005dd0| 72 65 20 74 68 61 74 20 | 65 6e 6f 75 67 68 20 6d |re that |enough m|
|00005de0| 65 6d 6f 72 79 20 69 73 | 20 66 72 65 65 20 66 6f |emory is| free fo|
|00005df0| 72 20 79 6f 75 72 20 61 | 70 70 6c 69 63 61 74 69 |r your a|pplicati|
|00005e00| 6f 6e 20 74 6f 20 72 75 | 6e 2e 20 49 74 0d 09 09 |on to ru|n. It...|
|00005e10| 69 73 20 70 6f 73 73 69 | 62 6c 65 20 66 6f 72 20 |is possi|ble for |
|00005e20| 61 20 73 69 74 75 61 74 | 69 6f 6e 20 74 6f 20 61 |a situat|ion to a|
|00005e30| 72 69 73 65 20 77 68 65 | 72 65 20 74 68 65 20 68 |rise whe|re the h|
|00005e40| 65 61 70 20 6d 61 79 20 | 68 61 76 65 20 62 65 65 |eap may |have bee|
|00005e50| 6e 20 6f 66 20 72 65 71 | 75 69 72 65 64 0d 09 09 |n of req|uired...|
|00005e60| 73 69 7a 65 2c 20 62 75 | 74 20 61 20 6c 61 72 67 |size, bu|t a larg|
|00005e70| 65 20 73 63 72 61 70 20 | 77 61 73 20 6c 6f 61 64 |e scrap |was load|
|00005e80| 65 64 20 77 68 69 63 68 | 20 6c 65 66 74 20 74 6f |ed which| left to|
|00005e90| 6f 20 6c 69 74 74 6c 65 | 20 6d 65 6d 6f 72 79 2e |o little| memory.|
|00005ea0| 20 54 6f 20 63 68 65 63 | 6b 20 66 6f 72 0d 09 09 | To chec|k for...|
|00005eb0| 74 68 69 73 2c 20 63 61 | 6c 6c 20 50 75 72 67 65 |this, ca|ll Purge|
|00005ec0| 53 70 61 63 65 20 61 6e | 64 20 63 6f 6d 70 61 72 |Space an|d compar|
|00005ed0| 65 20 74 68 65 20 72 65 | 73 75 6c 74 20 77 69 74 |e the re|sult wit|
|00005ee0| 68 20 61 20 76 61 6c 75 | 65 20 74 68 61 74 20 79 |h a valu|e that y|
|00005ef0| 6f 75 20 68 61 76 65 20 | 64 65 74 65 72 6d 69 6e |ou have |determin|
|00005f00| 65 64 0d 09 09 69 73 20 | 74 68 65 20 6d 69 6e 69 |ed...is |the mini|
|00005f10| 6d 75 6d 20 61 6d 6f 75 | 6e 74 20 6f 66 20 66 72 |mum amou|nt of fr|
|00005f20| 65 65 20 6d 65 6d 6f 72 | 79 20 79 6f 75 72 20 61 |ee memor|y your a|
|00005f30| 70 70 6c 69 63 61 74 69 | 6f 6e 20 6e 65 65 64 73 |pplicati|on needs|
|00005f40| 20 61 74 20 69 6e 69 74 | 69 61 6c 69 7a 61 74 69 | at init|ializati|
|00005f50| 6f 6e 2e 0d 09 09 54 68 | 69 73 20 6e 75 6d 62 65 |on....Th|is numbe|
|00005f60| 72 20 63 61 6e 20 62 65 | 20 64 65 72 69 76 65 64 |r can be| derived|
|00005f70| 20 73 65 76 65 72 61 6c | 20 64 69 66 66 65 72 65 | several| differe|
|00005f80| 6e 74 20 77 61 79 73 2e | 20 4f 6e 65 20 77 61 79 |nt ways.| One way|
|00005f90| 20 74 68 61 74 20 69 73 | 20 66 61 69 72 6c 79 0d | that is| fairly.|
|00005fa0| 09 09 73 74 72 61 69 67 | 68 74 66 6f 72 77 61 72 |..straig|htforwar|
|00005fb0| 64 20 69 73 20 74 6f 20 | 72 75 6e 20 74 68 65 20 |d is to |run the |
|00005fc0| 61 70 70 6c 69 63 61 74 | 69 6f 6e 20 69 6e 20 74 |applicat|ion in t|
|00005fd0| 68 65 20 6d 69 6e 69 6d | 75 6d 20 73 69 7a 65 20 |he minim|um size |
|00005fe0| 63 6f 6e 66 69 67 75 72 | 61 74 69 6f 6e 0d 09 09 |configur|ation...|
|00005ff0| 61 73 20 64 65 73 63 72 | 69 62 65 64 20 70 72 65 |as descr|ibed pre|
|00006000| 76 69 6f 75 73 6c 79 2e | 20 43 61 6c 6c 20 50 75 |viously.| Call Pu|
|00006010| 72 67 65 53 70 61 63 65 | 20 61 74 20 69 6e 69 74 |rgeSpace| at init|
|00006020| 69 61 6c 69 7a 61 74 69 | 6f 6e 20 61 6e 64 20 65 |ializati|on and e|
|00006030| 78 61 6d 69 6e 65 20 74 | 68 65 20 76 61 6c 75 65 |xamine t|he value|
|00006040| 0d 09 09 72 65 74 75 72 | 6e 65 64 2e 20 48 6f 77 |...retur|ned. How|
|00006050| 65 76 65 72 2c 20 79 6f | 75 20 73 68 6f 75 6c 64 |ever, yo|u should|
|00006060| 20 6d 61 6b 65 20 73 75 | 72 65 20 74 68 61 74 20 | make su|re that |
|00006070| 74 68 69 73 20 72 65 73 | 75 6c 74 20 69 73 20 6e |this res|ult is n|
|00006080| 6f 74 20 62 65 69 6e 67 | 20 6d 6f 64 69 66 69 65 |ot being| modifie|
|00006090| 64 0d 09 09 62 79 20 74 | 68 65 20 73 63 72 61 70 |d...by t|he scrap|
|000060a0| 27 73 20 70 72 65 73 65 | 6e 63 65 2e 20 59 6f 75 |'s prese|nce. You|
|000060b0| 20 63 61 6e 20 64 6f 20 | 74 68 61 74 20 62 79 20 | can do |that by |
|000060c0| 63 61 6c 6c 69 6e 67 20 | 5a 65 72 6f 53 63 72 61 |calling |ZeroScra|
|000060d0| 70 20 62 65 66 6f 72 65 | 20 63 61 6c 6c 69 6e 67 |p before| calling|
|000060e0| 0d 09 09 50 75 72 67 65 | 53 70 61 63 65 2e 20 4d |...Purge|Space. M|
|000060f0| 61 6b 65 20 73 75 72 65 | 20 74 6f 20 72 65 6d 6f |ake sure| to remo|
|00006100| 76 65 20 74 68 61 74 20 | 63 61 6c 6c 20 62 65 66 |ve that |call bef|
|00006110| 6f 72 65 20 73 68 69 70 | 70 69 6e 67 2c 20 74 68 |ore ship|ping, th|
|00006120| 6f 75 67 68 2e 20 2a 2f | 0d 09 0d 09 2f 2a 20 5a |ough. */|..../* Z|
|00006130| 65 72 6f 53 63 72 61 70 | 28 29 3b 20 2a 2f 0d 0d |eroScrap|(); */..|
|00006140| 09 50 75 72 67 65 53 70 | 61 63 65 28 26 74 6f 74 |.PurgeSp|ace(&tot|
|00006150| 61 6c 2c 20 26 63 6f 6e | 74 69 67 29 3b 0d 09 69 |al, &con|tig);..i|
|00006160| 66 20 28 74 6f 74 61 6c | 20 3c 20 6b 4d 69 6e 53 |f (total| < kMinS|
|00006170| 70 61 63 65 29 20 41 6c | 65 72 74 55 73 65 72 28 |pace) Al|ertUser(|
|00006180| 29 3b 0d 0d 09 2f 2a 09 | 54 68 65 20 65 78 74 72 |);.../*.|The extr|
|00006190| 61 20 62 65 6e 65 66 69 | 74 20 74 6f 20 77 61 69 |a benefi|t to wai|
|000061a0| 74 69 6e 67 20 75 6e 74 | 69 6c 20 61 66 74 65 72 |ting unt|il after|
|000061b0| 20 74 68 65 20 54 6f 6f | 6c 62 6f 78 20 4d 61 6e | the Too|lbox Man|
|000061c0| 61 67 65 72 73 20 68 61 | 76 65 20 62 65 65 6e 20 |agers ha|ve been |
|000061d0| 69 6e 69 74 69 61 6c 69 | 7a 65 64 0d 09 09 74 6f |initiali|zed...to|
|000061e0| 20 63 68 65 63 6b 20 6d | 65 6d 6f 72 79 20 69 73 | check m|emory is|
|000061f0| 20 74 68 61 74 20 77 65 | 20 63 61 6e 20 6e 6f 77 | that we| can now|
|00006200| 20 67 69 76 65 20 74 68 | 65 20 75 73 65 72 20 61 | give th|e user a|
|00006210| 6e 20 61 6c 65 72 74 20 | 74 6f 20 74 65 6c 6c 20 |n alert |to tell |
|00006220| 68 69 6d 2f 68 65 72 20 | 77 68 61 74 0d 09 09 68 |him/her |what...h|
|00006230| 61 70 70 65 6e 65 64 2e | 20 41 6c 74 68 6f 75 67 |appened.| Althoug|
|00006240| 68 20 69 74 20 69 73 20 | 70 6f 73 73 69 62 6c 65 |h it is |possible|
|00006250| 20 74 68 61 74 20 74 68 | 65 20 6d 65 6d 6f 72 79 | that th|e memory|
|00006260| 20 73 69 74 75 61 74 69 | 6f 6e 20 63 6f 75 6c 64 | situati|on could|
|00006270| 20 62 65 20 77 6f 72 73 | 65 6e 65 64 20 62 79 0d | be wors|ened by.|
|00006280| 09 09 64 69 73 70 6c 61 | 79 69 6e 67 20 61 6e 20 |..displa|ying an |
|00006290| 61 6c 65 72 74 2c 20 4d | 75 6c 74 69 46 69 6e 64 |alert, M|ultiFind|
|000062a0| 65 72 20 77 6f 75 6c 64 | 20 67 72 61 63 65 66 75 |er would| gracefu|
|000062b0| 6c 6c 79 20 65 78 69 74 | 20 74 68 65 20 61 70 70 |lly exit| the app|
|000062c0| 6c 69 63 61 74 69 6f 6e | 20 77 69 74 68 0d 09 09 |lication| with...|
|000062d0| 61 6e 20 69 6e 66 6f 72 | 6d 61 74 69 76 65 20 61 |an infor|mative a|
|000062e0| 6c 65 72 74 20 69 66 20 | 6d 65 6d 6f 72 79 20 62 |lert if |memory b|
|000062f0| 65 63 61 6d 65 20 63 72 | 69 74 69 63 61 6c 2e 20 |ecame cr|itical. |
|00006300| 48 65 72 65 20 77 65 20 | 61 72 65 20 61 63 74 69 |Here we |are acti|
|00006310| 6e 67 20 6d 6f 72 65 0d | 09 09 69 6e 20 61 20 70 |ng more.|..in a p|
|00006320| 72 65 76 65 6e 74 61 74 | 69 76 65 20 6d 61 6e 6e |reventat|ive mann|
|00006330| 65 72 20 74 6f 20 61 76 | 6f 69 64 20 66 75 74 75 |er to av|oid futu|
|00006340| 72 65 20 64 69 73 61 73 | 74 65 72 20 66 72 6f 6d |re disas|ter from|
|00006350| 20 6c 6f 77 2d 6d 65 6d | 6f 72 79 20 70 72 6f 62 | low-mem|ory prob|
|00006360| 6c 65 6d 73 2e 20 2a 2f | 0d 0d 09 2f 2a 20 4e 65 |lems. */|.../* Ne|
|00006370| 77 20 63 6f 64 65 20 74 | 6f 20 71 75 69 74 20 69 |w code t|o quit i|
|00006380| 66 20 73 79 73 74 65 6d | 20 63 6f 6e 66 69 67 75 |f system| configu|
|00006390| 72 61 74 69 6f 6e 20 69 | 73 20 6e 6f 74 20 72 69 |ration i|s not ri|
|000063a0| 67 68 74 20 3c 4d 43 3e | 20 2a 2f 0d 09 43 68 65 |ght <MC>| */..Che|
|000063b0| 63 6b 53 79 73 74 65 6d | 43 6f 6e 66 69 67 75 72 |ckSystem|Configur|
|000063c0| 61 74 69 6f 6e 20 28 29 | 3b 0d 0d 09 2f 2a 20 09 |ation ()|;.../* .|
|000063d0| 77 65 20 77 69 6c 6c 20 | 61 6c 6c 6f 63 61 74 65 |we will |allocate|
|000063e0| 20 6f 75 72 20 6f 77 6e | 20 77 69 6e 64 6f 77 20 | our own| window |
|000063f0| 73 74 6f 72 61 67 65 20 | 69 6e 73 74 65 61 64 20 |storage |instead |
+--------+-------------------------+-------------------------+--------+--------+
Only 25.0 KB of data is shown above.